AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

[Closed] Recent posts

5 Posts
4 Users
0 Reactions
4,762 Views
Posts: 4
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@smilingslimeguy)
Active Member
Joined: 10 years ago
[#3643]

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 🙂


4 Replies
Robert
Posts: 10753
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@robert)
Support Team
Joined: 3 months ago

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);

Posts: 5
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@thepath)
Active Member
Joined: 8 years ago

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!


Posts: 5
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@thepath)
Active Member
Joined: 8 years ago

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);

Posts: 1
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@z4driver)
New Member
Joined: 8 years ago

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.


Share: