[FREE] Convert WordPress Site to Kodular App for Free

Hello in this short Articles I am going to share how you can get data from your WordPress site on show it in list view in kodular. Below I Have shared the link to Download AIA

We are going to get data using RestAPI WordPress Function and then call data in list view in kodular application, I would Like to Thank @Dora_Paz for helping me in developing this application. I was able to build a Android App for my WordPress site ThePager which helps students get Free Certificate Courses & Internships.

Step 1)

To get your RestAPI link just add this at end of your WordPress Site “/wp-json/wp/v2/posts/” and just replace it from my link

Step 2 )

Create All the variables require, help? if you dont have knowledge of how to use variables in kodular kindly keep it same as in picture below

Step 3)

This is the final step where we get our data from WordPress and display it in list view

Download AIA: Click Me

9 Likes

Good job :+1:

Good Job
Use Guide Tags

Actually I am very new to this so I don’t know what’s Guide Text :sweat_smile:

@ Juned_Adenwalla Thanks for sharing that awesome guide. Could you please tell me how I can show the details content in another screen, after clicking any of items in this list?

Thank you, I am glad you liked it.

Well, I was working on the POST API of WordPress to post an article from an app as well, for your concerns I think just capture the post Id when the card is clicked and pass it through a variable to another screen and then call WordPress single post api by id.

API : yoursite.com /wp-json/wp/v2/posts/?filter[p]=470

Remove 470 and assign the variable where you have stored the post Id.

Check if this works for you :smiley:

2 Likes

Hello, Coder Thanks for your help it works but when i tried in my website, it show only last 10 posts and please how to show picture of each post in the listview

Hey!!!

to get featured image of post just add this code below in functions.php file

add_action('rest_api_init', 'register_rest_images' );
function register_rest_images(){
    register_rest_field( array('post'),
        'fimg_url',
        array(
            'get_callback'    => 'get_rest_featured_image',
            'update_callback' => null,
            'schema'          => null,
        )
    );
}
function get_rest_featured_image( $object, $field_name, $request ) {
    if( $object['featured_media'] ){
        $img = wp_get_attachment_image_src( $object['featured_media'], 'app-thumb' );
        return $img[0];
    }
    return false;
}

and add this below code in same functions.php file to get more than 10 posts this should return between 99 - 200 posts, but always remember the higher amount of posts you request the higher is the speed impact

add_filter( 'rest_post_collection_params', 'big_json_change_post_per_page', 10, 1 );
function big_json_change_post_per_page( $params ) {
    if ( isset( $params['per_page'] ) ) {
        $params['per_page']['maximum'] = 200;
    }
    return $params;
}
1 Like

Ok thanks very much i will try it

i finally found a solution ; just add this parameter in url : ?per_page=100 and to retrieve feature image we must install JETPACK

Example to retrieve 100 post at once
(https://aaa-aaa.com/wp-json/wp/v2/posts/?per_page=100)

Thanks for your help all things working now

Nice guide. It will be even nicer if more people join the discussion and bring new ideas.
Congratulations for the initiative

Glad you got solution but as far a my knowledge we dont require jetpack to get featured images
my solution above have you tried it?

Yes i tried it but not work for me

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.