get_posts causes all posts to be the same
-
I just recently converted my site over to Wordpass from plain ‘ole HTML (https://www.elizar.com). I wanted to use the “get_post” for my sidebar boxes. This is one such entry I used:
- <?php $posts = get_posts ‘numberposts=20&offset=0&category=2’); foreach($posts as $post) : ?>
- “><?php the_title(); ?
<?php endforeach; ?>
Everything seems fine after using it, but when I try clicking on the links, it stays stuck on a random post from the selected category. No matter what post I try to call up (or link I hit), the same post always comes up.
I assume either I’m using the command incorrectly, or my site layout is the problem… but for the life of me, I can’t tell which.
Thanks in advanced for the help.
***EDIT***
Ugh… can’t get the script to display correctly.Basically, I used the exact first example found at https://codex.www.ads-software.com/Template_Tags/get_posts but removed the “php the_excerpt” and changed the offset=0 and category=2
- The topic ‘get_posts causes all posts to be the same’ is closed to new replies.