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

 Sort Search Results by:

Filter by custom fields

Topic prefix

AI Assistant
Notifications
Clear all

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

5 Posts
2 Users
1 Reactions
1,454 Views
Posts: 17
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
(@martinasjam)
Eminent Member
Joined: 2 years ago
[#57797]

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: 5774
 Sofy
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
(@sofy)
Support Team
Joined: 8 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: 2 years ago

Eminent Member
Posts: 17
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

@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.

 Screenshot 2024 10 26 at 10.42.29 AM

Reply
Posts: 17
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
(@martinasjam)
Eminent Member
Joined: 2 years ago

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

 Screenshot 2024 10 26 at 10.40.54 AM

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

Support Team
Posts: 5774
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

@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
Share: