latest wordpress stories (code)
-
Just made a query in my forum functions.php to display the 5 latest stories from WordPress. Pretty basic but it may help someone:
// get WP news
function wpnews() {
global $bbdb;
$stories = $bbdb->get_results("SELECT post_title, guid, post_date_gmt FROM wp_posts WHERE post_type='post' AND post_status='publish' ORDER BY post_date_gmt DESC LIMIT 0,4");
foreach ($stories as $story) {
if ($i <= 4) {
echo '<li><a href="' . $story->guid . '">' .$story->post_title . '</a></li>';
$i++;
}
}
}then call it on your forum with <?php wpnews() ?> and style to suit.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.