I would like to request a way to display the recent posts out of a certain forum/subforum on a different page; I have a forum with all announcements, and I would like to display my latest announcements on the front page of my website.
Anyway I could do this? Any chance it will be implemented in later versions?
Thanks 🙂
I can only point a function to return an Array of recent posts. but I can't write a custom code. I'm sorry but this is not included in our support, our time is too limited. I hope you're familiar with PHP.
You should use this function:
global $wpforo;
$posts_args = array(
'orderby' => 'created', // forumid, order, parentid
'order' => 'DESC', // ASC DESC
'row_count' => 10
);
$recent_posts = $wpforo->post->get_posts($posts_args);
Hi,
I wonder if you have the time to expand on this a little? I have tried adding all sorts to the $post_args to make the topics forum specific.
$posts_args = array(
//'parentid' => '55',
'forumid' => '2',
//'include' => array(2),
'orderby' => 'postid',
'order' => 'DESC',
'row_count' => 10
);
$recent_posts = $wpforo->post->get_posts($posts_args);
As you can see I've been playing about with parentid, forumid and include to no avail.
Any tips much appreciated!
Worked it out, if anyone else needs this here is the code:
$posts_args = array(
'forumid' => '4',
'order' => 'DESC', // ASC DESC
'row_count' => 1
);
$recent_posts = $wpforo->topic->get_topics($posts_args);
Hi ThePath
I'm trying to do the same as you; are displaying the recent posts from two of my wpForo forums, 'Announcements' & 'News', on the front page of my site. I've tried using your code but nothing seems to happen. I've tried using it with PHP code snippets (Insert PHP) but nothing seems to be displayed. I am a novice at this so any help would be appreciated.