Notifications
Clear all

New Forum - only show 2 or 3 posts for home page

5 Posts
2 Users
1 Reactions
181 Views
Posts: 13
Topic starter
(@martinasjam)
Eminent Member
Joined: 8 months ago

I'd like to add a new forum but only show 2 or 3 latest posts for my home page to get new content there. The shortcode i use won't work because I'm already using a feed to pull and code in my functions.php page to show posts from another forum for up to a specific date range.

 

is it possible to only show 2-3 of a separate forum? either through functions.php OR shortcode?

thank you!

4 Replies
Sofy
Posts: 4802
 Sofy
Admin
(@sofy)
Support Team
Joined: 7 years ago

Hi,

We don't follow you well. Could you please rephrase your question? 

I'd suggest you check out the wpForo Boards system. More info here: https://wpforo.com/docs/wpforo-v2/categories-and-forums/forum-boards/

Reply
1 Reply
(@martinasjam)
Joined: 8 months ago

Eminent Member
Posts: 13

@sofy I currently have 2 boards - working well.

  • I'm creating another board that will be featured on the home page
  • For the new board, I only want to show 2 of the most recent posts. (see attached)
  • For my first 2 boards, I added code (see attached) to show more posts for my feed page: https://thebreastcastg.wpenginepowered.com/feed-2/
  • Now, I only want to show the most recent 2 posts for my 3rd board. How can I do that?

Hope this helps.

Reply
Posts: 13
Topic starter
(@martinasjam)
Eminent Member
Joined: 8 months ago

Here's a screenshot of an example of 2 posts I want to show from the new board.

Reply
1 Reply
Sofy
 Sofy
Admin
(@sofy)
Joined: 7 years ago

Support Team
Posts: 4802

@martinasjam 

The developers suggest using the hook code below: 

add_filter( 'wpforo_recent_posts_limit', function($limit){
    $boardid = WPF()->board->get_current('boardid');
    if( $boardid === 15 ){
        $limit = 2;
    }else{
        $limit = 365;
    }
    
    return $limit;
} );

Here’s a helpful article on safely adding custom code in WordPress:   https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/

Reply