Skip to:
Content
Pages
Categories
Search
Top
Bottom

show single forum description on reply template


  • sovvyg
    Participant

    @sovvyg

    Hi,

    Im hoping to add some custom text (forum description) to a single forum reply and i’m not sure which template file id need to adjust. I’d like the text to appear underneath Create New Topic in “Private: Data Specialists”

    So far i’ve been successful in getting the text above or below the forum content but not sure where to go from there:

    link

    Thanks
    L

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

  • Vinod Dalvi
    Participant

    @vinod-dalvi

    You can achieve this using below custom code in your site and editing the text “This is custom text” to whatever you want to display.

    function vvd_add_notice_before_topic_form() {
        ?>
            <div class="custom-text">
              <p>
                <?php _e( "This is custom text." ); ?>
              </p>
            </div>
        <?php
     }
     add_action( 'bbp_theme_before_topic_form_notices', 'vvd_add_notice_before_topic_form' );

    You can add that code either in the functions.php file in child theme or in small custom plugin.


    sovvyg
    Participant

    @sovvyg

    Hi Vinood, thanks for the code, it works perfectly.

    The only issue is that the text will need to be different for each forum which is why i was wondering if there was a way to pull the text from the forum description rather than add the custom text in the php file if that makes sense.

    If there is not a way then i will make the descriptions more global but ideally i’d be able to make each unique or have none at all.

    Thanks, Lauren


    sovvyg
    Participant

    @sovvyg

    never mind ive done it, thanks to you i merged your solution with mine and hey presto!

    function vvd_add_notice_before_topic_form() {
        
            echo '<div class="bbp-forum-content">';
    		echo bbp_forum_content();
    		echo '</div>';
        
     }
     add_action( 'bbp_theme_before_topic_form_notices', 'vvd_add_notice_before_topic_form' );

    Thanks again for your help 🙂


    Vinod Dalvi
    Participant

    @vinod-dalvi

    You are most welcome here 🙂

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