Jump to content

sunnykumar

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by sunnykumar

  1. Hi,
     
     Can any  one help me wit the pagination in android mobile App  Pls find the attached file for full code
     
    As per the below coe it displays only 40 posts but i have around 500 posts. I can increse
     
    function add_query_vars($public_query_vars) {
            $public_query_vars[] = $this->namespace.'_p';
                   return $public_query_vars;
        }
     
     
     
    $args = array(
                    'post_type' => 'post',
                    'post_status' => 'publish',
                    'category__in' => $categories,
                );
                if ($wp->query_vars[$this->namespace.'_p'] == 1){
                    $args['posts_per_page'] = 10;
                    $args['offset'] = 0;
                }else{
                    $args['posts_per_page'] = 40;
                    $args['offset'] = 10;
                }
                
                $posts = get_posts($args);
     
     
    I have tried but i am getting only 210 posts.only if i increse the post_per_page more than 70 in mobile android app it shows loding
     
    $args = array(
                    'post_type' => 'post',
                    'post_status' => 'publish',
                    'category__in' => $categories
                );
              if ($wp->query_vars[$this->namespace.'_p'] == 1){
                    $args['posts_per_page'] = 70;
                    $args['offset'] = 0;
                }
                if ($wp->query_vars[$this->namespace.'_p'] == 2){
                    $args['posts_per_page'] = 140;
                    $args['offset'] = 70;
                }
                if ($wp->query_vars[$this->namespace.'_p'] == 3){
                    $args['posts_per_page'] = 210;
                    $args['offset'] = 140;
                }

               

                $posts = get_posts($args);

    wp-app-maker.php

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.