using get_posts() always show the same post
-
I’m trying to put the get_posts function in the header template to call posts 9-16 by using this:
-
<?php
- "><?php the_title() ?>
$posts = get_posts('numberposts=8&offset=8');
foreach ($posts as $post):
setup_postdata($post);
?><?php endforeach; ?>
It works well, but the problem is when I use it, no matter which post I’m clicking on it always shows the 9th most recent post (the number of posts that I have offset get_posts by).
Though the title in the browser displays correctly as the title of the post I clicked on, the Post title and post content displayed on the page always belongs to the 9th most recent post.
Please help me on how I can avoid this…
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘using get_posts() always show the same post’ is closed to new replies.