Show Latest Posts with get_posts not working
-
Hi there!
Have two problems. First one is generating a list of the recent posts in my blog (the tabbox on the right side) which just don’t work (or more precisely: it displays all wrong).
The code I use for this is:
<?php $postslist = get_posts('numberposts=5&order=DESC&orderby=post_date'); foreach ($postslist as $post) : setup_postdata($post); ?> <ul> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><span><?php the_date(); ?></span></li> </ul> <?php endforeach; ?>
It worked fine over the last months but then the website was moved from a PHP4 server to a new PHP5 installed server and the problems began. I tried both re-importing the MySQL database via MySQL-Admin and reinstalling WordPress and let it create the tables.
But it just don’t work. The database is valid and error free. The post_date table is there and all entries in it show different dates. Also changing the orderby option to ASC don’t change anything.
Any suggestions? Are there any incompatibilities between WordPress and PHP4/5 which can result in this behavior?
Another problem which may have to do with the above mentioned problem are my Next/Previous post links on the post pages. They just stay the same on every single post and don’t change. What could cause this annoying behavior? I use the generic template tags to display them:
<?php previous_post_link('« %link') ?> <?php next_post_link('%link »') ?>
Any help would be much appreciated cause I’m a bit out of ideas in this case.
My Blog:
https://www.kremalicious.com/blogA Blog Post ( My latest post) – please scroll down, the post links are under the comments.
edit: Is it possible that all this bad behavior is caused by a bug in MySQL as described here?:
Solution for posts suddenly appearing in reverse order
- The topic ‘Show Latest Posts with get_posts not working’ is closed to new replies.