Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Wordpres pagination in Home Page or Front Page?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 150
    Comment on it

    Hello readers, today we discuss wordpress pagination in Home Page or Front Page.

    WordPress has the ability to split lists of articles, content, discussions or a single content into multiple pages "paged" navigation.

    WordPress offers built-in function to navigate through the articles, content, discussions. Theme authors can make use of  simple links for prior and next page, or perhaps numbered pagination.

    Generally, We use paged pagination in blog page and other pages. But the paged pagination doesn't work on the home page or front page, when we put the same code into other page it works.

    So I change the query for home page. Many developers face pagination not working on home page.

    You can use the below code for the same.

     

    <?php
    
            $paged = (get_query_var('page')) ? get_query_var('page') : 1;
            $args = array(
                'post_type'            => 'myblog', /*This is where you should put your Post Type */
                'posts_per_page'    => 3,
                'post_status'       => 'publish',
                'paged'             => $paged
            );
            // The Query
            query_posts($args);
    
            if(have_posts()){
                while(have_posts() {
    
              // write your code here .......
    
               }
            }
    
    posts_nav_link();
    wp_reset_query();
        ?>

     

    I hope it helps you. Thank You readers.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: