Skip to:
Content
Pages
Categories
Search
Top
Bottom

Link back to forum from individual Topic post page


  • terri.swiatek@yahoo.com
    Participant

    @terriswiatekyahoocom

    I’ve gotten my bbpress forum set up on my site and I need to somehow add a link back to the main forum page. Once users click on a individual topic to comment there is no easy link to get back to the main forum.

    I figured I could somehow add a link into one of the .php templates but nothing I add to them seems to show up at all on site. If anyone can point me to the correct .php template to modify or if there is a simple setting to enable this I’d greatly appreciate it.

    I’m on wordpress version 4.0 and bbpress version 2.5.4
    Thanks,

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

  • Robin W
    Moderator

    @robin-w

    can you post a url to an example of a page you would like this on, and say wherabouts would be ideal


    Robkk
    Moderator

    @robkk

    @terriswiatekyahoocom you can create a simple href link to go back to the forums thats how ive done it before. i just did this before <a href="example.com/forums"></a>


    @robin-w
    i think you can create a function using <?php echo site_url(); ?> and
    <?php printf (bbp_get_root_slug() ); ?> , i suck at php so i ended up with this sloppy code

    <a href="<?php echo site_url(); ?>/<?php printf (bbp_get_root_slug() ); ?>">Back to Forums</a>


    terri.swiatek@yahoo.com
    Participant

    @terriswiatekyahoocom

    @robin-w it is a password protected site so I cannot provide the URL to view the page but I’ve included a screenshot here with red circles of where I’d like the link to possibly appear.

    screenshot with red circles where I'd like the back link to appear


    @Robkk
    What file did you add your Back to Forum link to? That is really all I want to add I just don’t know what file to put it so it shows up on all the topic pages.


    Robkk
    Moderator

    @robkk

    i added mine by copying loop-topics.php to my child theme and placing it above

    <li class="bbp-header">

    it looks like you want it to be above the header in loop-replies.php though.


    terri.swiatek@yahoo.com
    Participant

    @terriswiatekyahoocom

    Thanks @Robkk it wasn’t loop-replies.php but I found it. pagination-replies.php was the one.

    I added it in right after bbp-pagination-count

    <div class="bbp-pagination-count">
    		<a style="float:left;" href="http://intranet.skmgroup.com/forums/forum/skm-forum/">Back to Forums ></a>
    		<?php bbp_search_pagination_count(); ?>
    
    	</div>

    I floated it left too so it was positioned where I circled in red.

    Also this only seemed to work when I created a bbpress folder for the files in my child theme. Overwriting the template files in the plugins folder didn’t seem to do diddly.


    Robkk
    Moderator

    @robkk

    @terriswiatekyahoocom

    do mess with the templates in the plugin folder they will just be gone when you update the bbpress plugin.

    just copy the templates to your child theme and edit those.

    do not do inline styles, you can just add a class to the link and add the css to the bbpress.css file that you should copy to your child theme in a folder called css.

    i would recommend not to put the code into your pagination template. it would be fine if you just put it into content-single-topic.php you can just put it i think under
    <?php bbp_single_topic_description(); ?>

    i gave you the wrong code earlier actually so my bad, the one i had takes you to the forum index.
    this is the final code should be this exactly

    <?php if ( bbp_is_single_topic() ) : ?>
    
    <a class="bbp-back-to-forum" href="<?php bbp_forum_permalink(); ?>">Back to <?php bbp_forum_title(); ?></a>	
    	<?php endif; ?>

    what this does is only show the link on a single topic, so it wont show it on topics started page a subscribed/favorited topics page.

    it takes you to the forum of any topic you have, so if you have multiple forums you wont have to write the exact link everytime.

    it adds a class which is a.bbp-back-to-forum

    and the link shows the actual name of the forum.

    then you can style the link by using.

    a.bbp-back-to-forum {
    float:left;
    }

    drop the css into your bbpress.css in your child theme.

    also please read the codex, it has alot of very useful information about bbPress.

    Codex


    Robkk
    Moderator

    @robkk

    *do NOT mess with the templates in the plugin folder

    jeez -_-


    sharongraylac
    Participant

    @sharongraylac

    Thank you, Robkk! That helped me too!!!!


    tapiohuuhaa
    Participant

    @tapiohuuhaa

    This helped also me. I asked about this issue also in bbp style pack forum.

    In order to get rendered only in single topic page, I used

    function newTopic3(){
    echo… // something before
    echo bbp_forum_permalink();
    echo … // something after, includes #new-post
    }
    add_action( ‘bbp_template_before_single_topic’ , ‘newtopic3’);


    Eliyahna
    Participant

    @eliyahna

    @terriswiatekyahoocom What is method of placing the content-single-topic.php file in the child theme folder? I put it directly with no result. I created /childtheme/plugins/bbpress/templates/default/bbpress/ and placed it in there with no results also.

    I finally put it in the parent theme folder and it works but I know this will get overwritten with updates…


    Robin W
    Moderator

    @robin-w

    wp-content/themes/%your-theme-name%/bbpress/content-single-topic.php


    Eliyahna
    Participant

    @eliyahna

    Thank you @robin-w! Can this be altered to include a link back to the /forums/ page? I tried that also but it failed


    Robin W
    Moderator

    @robin-w

    sorry, I don’t know what didn’t work, the whole thing or the link?


    Eliyahna
    Participant

    @eliyahna

    Here’s what I tried that didn’t work…

    <a class="bbp-back-to-forum" href="<?php bbp_forum_permalink(); ?>">Back to <?php bbp_forum_title(); ?></a>	<?php 
    	echo '<a href="www.mylink.org/forums/">Back To Forums List</a>'; ?> 
Viewing 14 replies - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.
Skip to toolbar