get_posts() ignoring parameters
-
Hello everyone, wondered if someone could shed some light on this.
I have referenced the page for the function get_posts() in order to be able to grab the list of posts from a particular category (in this case ‘news’) but for some reason it’s returning a random post in a completely different category.
My code is as follows:
<?php global $blog; $myarticles = get_posts('numberposts=3&offset=0&category_name=news'); foreach($myarticles as $article) : ?> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br /> <?php the_date(); ?><br /> <?php endforeach; ?>
Here I am grabbing all the News Articles I have written and placing the most recent three on the page, but it’s not doing that – instead it’s putting the title of one random post from my database. Can’t understand why – is there something I’m missing?
Thanks in advance for any help.
Michael
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘get_posts() ignoring parameters’ is closed to new replies.