Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding content above forum – possible?


  • robineero
    Participant

    @robineero

    I am working on a health forum and I would like to add little introduction above every forum.

    For example: Instead of this I would like to have such view:

    Is it possible to achieve somehow without editing much of the theme? I am using Barcelona theme.

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

  • robineero
    Participant

    @robineero

    I am thinking of soving this idea by creating new page for every forum page with shortcodes and by using redirection plugin to redirect original forum link to customised one.

    Does it make sense?


    Robin W
    Moderator

    @robin-w

    you can do it by amending a template if you know how to do ftp

    create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    find
    wp-content/plugins/bbpress/templates/default/bbpress/content-single-forum.php
    Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/content-single-forum.php
    bbPress will now use this template instead of the original
    and you can amend this

    so amend this template to read

    
    <?php
    
    /**
     * Single Forum Content Part
     *
     * @package bbPress
     * @subpackage Theme
     */
    
    ?>
    
    <div id="bbpress-forums">
    
    	<div id="forum-intro">
    	
    	<?php if (bbp_get_forum_title() == 'technical' ) echo 'this is some content' ; ?>
    	
    	<?php if (bbp_get_forum_title() == 'leisure' ) 	echo 'this is some different content' ; ?>
    	
    	</div>
    
    	<?php bbp_breadcrumb(); ?>
    
    	<?php bbp_forum_subscription_link(); ?>
    
    	<?php do_action( 'bbp_template_before_single_forum' ); ?>
    
    	<?php if ( post_password_required() ) : ?>
    
    		<?php bbp_get_template_part( 'form', 'protected' ); ?>
    
    	<?php else : ?>
    
    		<?php bbp_single_forum_description(); ?>
    
    		<?php if ( bbp_has_forums() ) : ?>
    
    			<?php bbp_get_template_part( 'loop', 'forums' ); ?>
    
    		<?php endif; ?>
    
    		<?php if ( !bbp_is_forum_category() && bbp_has_topics() ) : ?>
    
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'loop',       'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    			<?php bbp_get_template_part( 'form',       'topic'     ); ?>
    
    		<?php elseif ( !bbp_is_forum_category() ) : ?>
    
    			<?php bbp_get_template_part( 'feedback',   'no-topics' ); ?>
    
    			<?php bbp_get_template_part( 'form',       'topic'     ); ?>
    
    		<?php endif; ?>
    
    	<?php endif; ?>
    
    	<?php do_action( 'bbp_template_after_single_forum' ); ?>
    
    </div>

    You will see I have added lines to change the content per forum

    so the line

    <?php if (bbp_get_forum_title() == 'technical' ) echo 'this is some content' ; ?>

    says that if the forum is called ‘technical’ then write ‘this is some content’ so you simply need to change the forum name and what you want that forum content to be.

    You can add additional lines for each forum, my example has two forums ‘technical’ and ‘leisure’

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