Quantcast
Channel: bbPress.org » All Posts
Viewing all articles
Browse latest Browse all 3638

Reply To: Dropdown menu with all forums – How to ?

$
0
0

Thanks for the tip but i actually ended up adding the following at the top of the pages i needed it on :

$args = array(
	'post_parent' => 0,
);

Not very DRY as it is repeated (i could have done a function though…) but it does the job perfectly.
HOWEVER, since every loop resets the $args array, i think it only works for me because my dropdown menu with the forums is before any other loop on the page.

Here is the code i added in the pages i needed to show the dropdown (bootstrap):


<?php if ( bbp_has_forums($args) ) : ?>
	<?php while ( bbp_forums() ) : bbp_the_forum(); ?>
		<li><a id="textdropdown" class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>"><?php bbp_forum_title(); ?></a></li>
	<?php endwhile; ?>
<?php else : ?>
	<?php bbp_get_template_part( 'feedback', 'no-forums' ); ?>
<?php endif; ?>

I hope this helps you @selenii and anybody else who was trying to do this. I would however recommend Robkk’s way as it uses clean code from bbPress. Haven’t tried it though.

Good luck and thank you!


Viewing all articles
Browse latest Browse all 3638

Trending Articles