BuddyDev

Search

BBpress – show sub sub forums

  • Participant
    Level: Enlightened
    Posts: 118
    Erich199 on #7156

    Hi Brajesh,
    I’m wondering if it’s possible for my forum to show sub forums of forums? I have a custom forum loop that I’ll share with you here and maybe there is a small tweak to accomplish this.

    Thanks for the help in advance.

    
    <?php
    
    /**
     * Forums Loop - Single Forum
     *
     * @package bbPress
     * @subpackage Theme
     */
    
    ?>
    
    <ul id="bbp-forum-<?php bbp_forum_id(); ?>" <?php bbp_forum_class(); ?>>
    
    	<li class="bbp-forum-info">
    
    		<?php if ( bbp_is_user_home() && bbp_is_subscriptions() ) : ?>
    
    			<span class="bbp-row-actions">
    
    				<?php do_action( 'bbp_theme_before_forum_subscription_action' ); ?>
    
    				<?php bbp_forum_subscription_link( array( 'before' => '', 'subscribe' => '+', 'unsubscribe' => '&times;' ) ); ?>
    
    				<?php do_action( 'bbp_theme_after_forum_subscription_action' ); ?>
    
    			</span>
    
    		<?php endif; ?>
    
    		<?php do_action( 'bbp_theme_before_forum_title' ); ?>
    
    		<a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>" title="<?php bbp_forum_title(); ?>">
    			
    			<?php bbp_forum_title(); ?> 		
    			
    			<?php if ( bbp_is_forum_archive() ) { ?>
    				<?php do_action( 'bbp_theme_before_forum_description' ); ?>
    				<div class="bbp-forum-content"><?php the_content(); ?></div>
    				<?php do_action( 'bbp_theme_after_forum_description' ); ?>
    			<?php } ?>	
    					
    		</a>
    
    		<?php do_action( 'bbp_theme_after_forum_title' ); ?>
    		
    		<?php if ( ! bbp_is_forum_archive() ) { ?>
    			<?php do_action( 'bbp_theme_before_forum_description' ); ?>
    			<div class="bbp-forum-content"><?php the_content(); ?></div>
    			<?php do_action( 'bbp_theme_after_forum_description' ); ?>
    		<?php } ?>	
    
    		<?php do_action( 'bbp_theme_before_forum_sub_forums' ); ?>
    
    		<?php ghostpool_bbp_list_forums( array (
    		'before'            => '<ul class="bbp-forums-list">',
    		'after'             => '</ul>',
    		'link_before'       => '<li class="bbp-forum">',
    		'link_after'        => '</li>',
    		'count_before'      => '<div class="topic-reply-counts">' . esc_html__( 'Topics', 'ghostpool_lang' ) . ': ',
    		'count_after'       => '</div>',
    		'count_sep'         => '<br />' . esc_html__( 'Posts', 'ghostpool_lang' ) . ': ',
    		'separator'         => '<div class="gp-clear"></div>',
    		'forum_id'          => '',
    		'show_topic_count'  => true,
    		'show_reply_count'  => false,
    		'show_post_count'  => true,
    		'show_freshness_link' => true,
    		)); ?>
    
    		<?php do_action( 'bbp_theme_after_forum_sub_forums' ); ?>
    
    		<?php bbp_forum_row_actions(); ?>
    
    	</li>
    
    	<li class="bbp-forum-topic-count">
    		<div class="topic-reply-counts"><?php esc_html_e( 'Topics', 'ghostpool_lang' ); ?>: <?php bbp_forum_topic_count(); ?></div>
    		<div class="topic-reply-counts"><?php esc_html_e( 'Posts', 'ghostpool_lang' ); ?>: <?php bbp_show_lead_topic() ? bbp_forum_reply_count() : bbp_forum_post_count(); ?></div>
    	</li>
    
    	<li class="bbp-forum-freshness">
    
    		<p class="bbp-topic-meta">
    
    			<?php do_action( 'bbp_theme_before_topic_author' ); ?>
    
    			<span class="bbp-topic-freshness-author"><?php bbp_author_link( array( 'post_id' => bbp_get_forum_last_active_id(), 'size' => 14 ) ); ?></span>
    
    			<?php do_action( 'bbp_theme_after_topic_author' ); ?>
    
    		</p>
    				
    		<?php do_action( 'bbp_theme_before_forum_freshness_link' ); ?>
    
    		<?php bbp_forum_freshness_link(); ?>
    
    		<?php do_action( 'bbp_theme_after_forum_freshness_link' ); ?>
    		
    	</li>
    
    </ul><!-- #bbp-forum-<?php bbp_forum_id(); ?> -->
    
  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #7158

    Hi Joshua,
    There exists a function for this

    
    bbp_list_forums( array(
       'forum_id' => bbp_get_forum_id()
    ) );
    
    

    You can use that for listing the sub forums.

    Hope that helps.

  • Participant
    Level: Enlightened
    Posts: 118
    Erich199 on #7238

    Hey Brajesh,
    Thanks for the response. Do I add this into my theme’s function file or into the loop file that i posted above?

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #7245

    Hi Joshua,
    Please put it in the loop file(at the top).

    Please do let me know how it goes?

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 118
    Erich199 on #7326

    Hi Brajesh,

    Thanks for the clarification. For some reason when I place it in that loop file, it’s breaking the theme.

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #7327

    Hi Joshua,
    I am sorry. Do you mean the layout of the theme or the content generated is not the real list?

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 118
    Erich199 on #8274

    Hey Brajesh,

    Sorry for the really long delay. I’ve been busy with work.

    I want my main forum
    https://www.artofwargaming.net/community

    To show the subforums underneath the forums. So if you click on this forum:
    https://www.artofwargaming.net/community/forum/community-forums/off-topic-discussions/

    There is a subforum titled “Introductions”. I just want the subforums listed underneath the main forum in the main forum view. I hope this makes sense.

The topic ‘BBpress – show sub sub forums’ is closed to new replies.

This topic is: not resolved