can you post a url to an example of a page you would like this on, and say wherabouts would be ideal
@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>
@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.
@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.
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.
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.
@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
*do NOT mess with the templates in the plugin folder
jeez -_-
Thank you, Robkk! That helped me too!!!!
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’);
@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…
wp-content/themes/%your-theme-name%/bbpress/content-single-topic.php
Thank you @robin-w! Can this be altered to include a link back to the /forums/ page? I tried that also but it failed
sorry, I don’t know what didn’t work, the whole thing or the link?
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>'; ?>