post-navigation on front-page
-
hello,
I am building a template from scratch.
i have a problem with the post-navigation on my front-page.php (static page).
it will always return the same posts…If i change in Admin->Settings->Reading->Front page ->displays to ->Your latest posts the same code works perfectly.
What am I doing wrong?
front-page.php:<?php /** * Template Name: Home Template */ get_header(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> //home page stuff <?php endwhile; else: ?> // <?php endif; ?> <div id="site-content"> <div id="list"> <?php $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query('showposts=5' . '&paged=' . $paged); ?> <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <?php get_template_part('content', get_post_format()); ?> <?php endwhile; ?> </div> </div> <?php if ($paged > 1) { ?> <nav id="nav-posts"> <div class="prev"><?php next_posts_link('« Previous Posts'); ?></div> <div class="next"><?php previous_posts_link('Newer Posts »'); ?></div> </nav> <?php } else { ?> <nav id="nav-posts"> <div class="prev"><?php next_posts_link('« Previous Posts'); ?></div> </nav> <?php } ?> <?php wp_reset_postdata(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘post-navigation on front-page’ is closed to new replies.