[Resolved] Pagination for static blog page

Home Forums Support [Resolved] Pagination for static blog page

Home Forums Support Pagination for static blog page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #580198
    Philipp

    Please take a look at http://www.ktf2018.ch. Here I use a static homepage page-home.php where I output the latest posts of a specific category which works so far.

    The issue I have: pagination (at the bottom of the page) is not working. So URL’s like http://www.ktf2018.ch/page/2/ or http://www.ktf2018.ch/page/3/ don’t work.

    Find my code here (screenshot)

    Can it be related to codex.wordpress.org/Pagination (scroll down to “Static Front Page”)?

    Thanks,
    Philipp

    #580455
    Tom
    Lead Developer
    Lead Developer

    That could definitely be the issue.

    I also suggest using WP_Query instead of query_posts, as they show in that example.

    #586601
    Philipp

    Thank you Tom, it worked for me:

    if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); }
    elseif ( get_query_var( 'page' ) ) { $paged = get_query_var( 'page' ); }
    else { $paged = 1; }
    
    $the_query = new WP_Query('posts_per_page=12&paged=' . $paged); 
    
    ?>
    
    <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); // run the loop ?>
    #586644
    Tom
    Lead Developer
    Lead Developer

    You’re welcome! 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.