Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Names immitate wp_list_pages()

  • Two part question

    1. Is there a code to imitate wp_list_pages(‘title_li=’) with the forum names?

    result in…

    <li><a href="http://bbpress.org/forums/forum/installation">Installation</a></li>
    <li><a href="http://bbpress.org/forums/forum/troubleshooting">Trouble Shooting</a></li>

    etc etc…

    2. How do you add class=selected to current forum page?

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

  • psycheangels
    Member

    @psycheangels

    Yes, thank you! I edited to fit my needs.

    with this code

    <?php if ( bb_forums() ) : 	while ( $depth = bb_forum() ) : if( $depth > $last_depth ) : ?>
    <?php echo str_repeat(" ",$depth) ?>
    <?php else : ?></li>
    <?php while( $depth < $last_depth ) : echo str_repeat(" ",$depth+1) ?>
    <?php echo str_repeat(" ",$depth) ?></li>
    <?php $last_depth--; endwhile; endif; if (bb_get_forum_is_category()) :
    echo str_repeat(" ",$depth) ?><li class="forum_cat"><a href="<?php forum_link() ?>" title="<?php forum_description(array('before'=>'','after'=>'')) ?>"><?php forum_name() ?></a>
    <?php else :
    echo str_repeat(" ",$depth+1) ?><li class="forum_subforum"><a href="<?php forum_link() ?>" title="<?php forum_description(array('before'=>'','after'=>'')) ?>"><?php forum_name() ?></a>
    <?php endif; $last_depth = $depth; endwhile ?>
    </li>
    </ul>

    # 2. how do I make the current forum have a class=”selected”


    psycheangels
    Member

    @psycheangels

    i dont understand with your second question.

    maybe you can give me an example forum page.

    Okay I will have on my header the Forum Names as “Pages”

    Installation – Troubleshooting – Themes – Plugins – etc

    When I’m on the Troubleshooting page (https://bbpress.org/forums/forum/troubleshooting) the class of trouble shooting will be “selected”.

    <li><a href="https://bbpress.org/forums/forum/installation">Installation</a></li>
    <li><a href="https://bbpress.org/forums/forum/troubleshooting" class="selected">Trouble Shooting</a></li>

    make sense?


    psycheangels
    Member

    @psycheangels

    before the loop

    $forumselect = get_forum_id();

    and in the loop

    <li class=”<?php if ( get_forum_id() == $forumselect ) : ?>selected<?php else: ?>forum_subforum<?php endif; ?>”>

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