0
votes

I'm converting a site to Wordpress and I'm turning pages that were mostly PHP into page templates, then publishing them as blank pages with that template.

This has worked fine, with one exception that I've noticed. On the default template, (I'm using the Whiteboard theme) calls to wp_get_recent_posts() work as expected. However, on any of the new page templates, wp_get_recent_posts() returns nothing. I also tried using the Exec-PHP plugin and I've noticed that while it's active, wp_get_recent_posts() doesn't work on the default template either. Is there something I need to register to get this function to work properly?

---Update

It looks like whenever I call a function that accesses a database is what breaks the wp_get_recent_posts() call. Should I move my wordpress install to a seperate database?

2

2 Answers

0
votes

This may not solve your problem because there really is not enough details to make a call but have you tried:

get_posts()

This can also show recent posts and I have not heard of anyone having the difficulties you are talking about. Here is a link to codex on this call.

0
votes

You have the 3 most recent post from the news category !

<?php

$recentPosts = new WP_Query();

$recentPosts->query('showposts=3&category_name=news');

$cont=1;

while ($recentPosts->have_posts()) : $recentPosts->the_post(); 

the_content();

$cont++;

endwhile;
?>