Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display forum'description on the front-end


  • vauvarin
    Participant

    @vauvarin

    Hello,

    I would like to display on the front-end (over forum list on bbpress root page) the forum’s description (see here: http://i.imgur.com/o3c5iA1.png … to see what i’m speaking about).

    I know there is a hook to put some content in this area “bbp_template_before_forums_index” but is there a function or a shortcode to get the forum’s description (http://i.imgur.com/o3c5iA1.png) ?

    Thx

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

  • Robin W
    Moderator

    @robin-w

    The forums list display comes under the template

    wp-content/plugins/bbpress/templates/default/bbpress/loop-single-forum.php

    There are many hooks in this

    Line 44 does the sub forum display


    vauvarin
    Participant

    @vauvarin

    I found this solution :

    add_action( 'bbp_template_before_single_forum' , 'xxxx_bbp_display_forum_description' );
    
    function xxxx_bbp_display_forum_description() {
        echo '<div>';
        bbp_forum_content();
        echo '</div>';
    }

    vauvarin
    Participant

    @vauvarin

    Maybe better like this :

    add_action( 'bbp_template_before_single_forum' , 'xxxx_bbp_display_forum_description' );
    
    function xxxx_bbp_display_forum_description() {
    
        $display_forum_description = bbp_get_forum_content();
    
        if ( bbp_is_single_forum() && ! empty( $display_forum_description ) ) {
        
            echo '<div class="bbp-display-forum-description">';
            echo $display_forum_description;
            echo '</div>';
    
        }

    }


    Robin W
    Moderator

    @robin-w

    looks good, have you tried it and does it work,

    If so I’ll add it to the codex


    vauvarin
    Participant

    @vauvarin

    Yep, works perfectly :)


    Robin W
    Moderator

    @robin-w

    Thanks, I’ve slightly amended it to get it to display on all pages and added it to the documentation

    http://codex.bbpress.org/layout-and-functionality-examples-you-can-use/#16-adding-description-to-forum-pages

    Thanks again for posting your solution !

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

You must be logged in to reply to this topic.