get_posts doesn’t work after 2.6 upgrade
So I just updated my WP version to 2.6 and a function I used in my sidebar to call the latest post from 2 specific categories doesn’t seem to work any longer. Instead of getting the latest post from my chosen categories, I get the latest post globally.
Here’s the code I used:
<?php $lastposts = get_posts('numberposts=1&category=7&orderby=post_date&order=DESC'); foreach($lastposts as $post) : setup_postdata($post); ?> <p> <?php the_title(); ?> <?php if ($post->post_excerpt) : $output = $output = $post->post_excerpt; $output .= ' <a href="http://www.twowordheap.com/category/site-news/" title="Continue reading...">Continue reading...</a>'; echo apply_filters('the_excerpt',$output); else: the_content(); endif; ?> </p> <?php endforeach; ?>
The whole post excerpt section is something concocted in these very forums and has worked without a problem since I implemented it. I don’t think it is causing any problems as I can switch it out with just the_content() and I still get the same problem (you know, just with the entire post instead of the excerpt).
- The topic ‘get_posts doesn’t work after 2.6 upgrade’ is closed to new replies.