Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display only 5 recent topics and show certain forums?


  • strangelife
    Participant

    @strangelife

    Hi Everyone!

    For my main forum homepage or the archive i want to display different forums into sections rather than having a list of forums that is the bbpress default.

    So this is the code used to display all the forums,

    <?php while ( bbp_forums() ) : bbp_the_forum(); ?>
    
    	<?php bbp_get_template_part( 'loop', 'single-forum' ); ?>
    
    <?php endwhile; ?>
    

    So how would i add some arguments to this to display certain forums from there ID’s?

    Also on the main page i want to show 5 recent topics, i believe the loop code is this,

    <?php while ( bbp_topics() ) : bbp_the_topic(); ?>
    
    	<?php bbp_get_template_part( 'loop', 'single-topic' ); ?>
    
    <?php endwhile; ?>
    

    If anyone has managed to use a custom loop using the above code to display 5 recent topics or a custom WP_Query, i’ll be very grateful if you could show some example code.

    Kind Regards
    ~ Matt

Viewing 11 replies - 1 through 11 (of 11 total)

  • inspirationally
    Participant

    @inspirationally

    Did you find out already? I wanted to do the same.


    Biswadip
    Participant

    @biswadip

    I too am looking for examples for displaying the latest replies, topics etc. from specific forums.

    I am resorting to trying to get the information from the database with mysql queries but because a reply has a parent of topic which has a parent of forum_id I am not sure how to get the forum_id of a reply.


    inspirationally
    Participant

    @inspirationally

    Found out –
    you can simply use Widgets inside your template.

    I also installed the tehnik-bbpress-permissions plugin to not show the hidden forums topics and put this into my template:

    <?php the_widget( 'Tehnik_BBP_Replies_Widget', $instance, $args ); ?> 
    

    This should work with the default BBP Replies Widget, too (just need to find out the name of it)

    Will try a bit more customization today with an eye on https://codex.wordpress.org/Function_Reference/the_widget

    Another possibility is manually:

    	<?php do_action( 'bbp_template_before_topics_index' ); ?>
    
            <?php if ( bbp_has_topics( array( 'author' => 0, 'show_stickies' => false, 'order' => 'DESC', 'post_parent' => 'any', 'posts_per_page' => 5 ) ) ) : ?>
                    <?php bbp_get_template_part( 'bbpress/loop', 'recent-topics' ); ?>
            <?php else : ?>
                    <?php bbp_get_template_part( 'bbpress/feedback', 'no-topics' ); ?>
            <?php endif; ?>
    
    	<?php do_action( 'bbp_template_after_topics_index' ); ?>

    Bard
    Participant

    @dreamwork

    Is there a way doing this by using shortcode?


    optimizepress
    Participant

    @optimizepress

    just implemented :)


    Robin W
    Moderator

    @robin-w

    @dreamwork

    I have a plugin that does xx topics

    http://www.rewweb.co.uk/bbpress-additional-shortcodes/
    if that is what you are after


    Bard
    Participant

    @dreamwork

    @robin-w
    oops!! YOU SHOULD JUST PRICE IT!!(I am sorry, I just downloaded it)


    Robin W
    Moderator

    @robin-w

    not sure what you mean?


    Bard
    Participant

    @dreamwork

    lot of people seeking this, for the use of their clients. we may have this by using php code, but unfamiliar for our clients. Especially when using something “visual composer”!


    Robin W
    Moderator

    @robin-w

    :-)


    Robin W
    Moderator

    @robin-w

    just updated this to do a particular forum as well !

    http://www.rewweb.co.uk/bbpress-additional-shortcodes/

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.
Skip to toolbar