• Hello all,

    I have, among other contents, 5 latest posts displayed on my static front page. Is there a way to get the “previous/next post” navigation below these posts?

    I’m using a child theme of Twenty Seventeen and I tried the following on content-front-page.php, but no navigation is displayed:

    $args = array(
    	'post_type' => 'post', // enter custom post type
    	'orderby' => 'date',
    	'order' => 'DESC',
    	'posts_per_page' => 5,
    	'offset'=> 1
    );
    
    $loop = new WP_Query( $args );
    if( $loop->have_posts() ):
    while( $loop->have_posts() ): $loop->the_post(); global $post;
    
    	  echo '<div><a href="'.get_permalink().'"><div>'.get_the_post_thumbnail( $id, array(120,120) ).'</div><h3>'.get_the_title().'</h3></a><p>'.get_the_date().'</p><p class="desc">'.get_the_excerpt().'</p></div>';
    
    endwhile;
    
    	  echo posts_nav_link();
    	  wp_reset_postdata();
    
    endif;

    I read here the following; does it apply to my case?

    Static front pages are not intended to be paged. None of the WordPress Previous / Next page link functions work with a static front page. Pagination on a static front page uses the page query variable, not the paged variable. See the WP_Query for details.

    In advance thanks for your precious help.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Next and previous post navigation on static front page?’ is closed to new replies.