Tagged: bbpress
-
AuthorPosts
-
July 10, 2020 at 5:12 pm #1229455
Hi,
I am setting up a bbpress forum. As per default, the standard titles for forum threads seem to be disabled.How can I have the title of a forum thread displayed on top of the page?
Thank you for the support and best regards, Peter
July 14, 2020 at 11:50 am #1230266Hey P3T3R_0ne,
Thank you for the inquiry.
In order to keep the design or layout of the pages consistent including the forums, the theme overrides the default forum templates. If you want to add the title to the topic or forum pages, we have to modify the includes > loop-pages.php file. You can add the title inside the header container.
echo '<header class="entry-content-header">';
Start with this code.
if(bbp_is_single_topic()) { bbp_topic_title(); } if(bbp_is_single_forum()) { bbp_forum_title(); }
The snippet above will only return the title without any styling. If you want to style it, try to wrap it in some html tags.
Best regards,
IsmaelJuly 15, 2020 at 5:26 pm #1230668Hi Ismael,
I tried to come up with a function which will display the title. However, it’s not sound yet. Please review the code
// add title to bbpress forum and bbpress topic pages function show_title_bbpress_topics() { if(bbp_is_single_topic()) { bbp_topic_title(); } if(bbp_is_single_forum()) { bbp_forum_title(); } /*echo '<header class="entry-content-header">';*/ } add_action('wp_footer', 'show_title_bbpress_topics');
This lets the title show below the footer because of wp_footer. I just did that for testing. I struggle to find the right hook. I tried wp_body_open, but it doesn’t display anything.
1) Which hook should I use?2) Also, how to modify the code in order to give the title a css ID?
3) Another related question. I found the the config-bbpress > config.php file which has all sorts of custom changes specifically for enfold theme. Maybe somewhere there one can enable showing the title.
Thank you for helping out and best regards, Peter
July 17, 2020 at 8:03 am #1231126Hi,
Thank you for the update.
1.) You can try the ava_after_main_title but it will render the title outside the main container or away from the forum content. Better solution is to directly modify the includes > loop-page.php file as suggested previously.
2.) You can wrap it inside an html tag, a div or a span tag with a class or ID attribute, so that you can style it properly.
Example:
if(bbp_is_single_topic()) { echo "<div class='bbp-topic-title'>".bbp_get_topic_title()."</div>"; }
You can then use the selector “.bbp-topic-title” to style the text.
3.) We have already checked that file and there’s nothing there that removes the forum or topic title. The reason they don’t display is because of the modified template (loop-page.php) as we have said earlier.
Best regards,
IsmaelAugust 11, 2020 at 1:08 pm #1236661Hi,
I had a look in the index.php and forum.php files to check about the loop. However, I don’t know what to change in order to have the title displayed.
Can you please explain step by step? I need to come up whit short custom php code which I can include in the child theme.
August 14, 2020 at 3:47 am #1237640Hi,
You should be able to use the bbp_forum_title and bbp_topic_title in the template to display the title in the loop. In the includes > loop-page.php file, you can maybe add the function below this line.
<div class="entry-content-wrapper clearfix">
Best regards,
IsmaelAugust 14, 2020 at 3:03 pm #1237839Hi Ismael,
I was able to have the title displayed with the following function included just below <div class=”entry-content-wrapper clearfix”> in loop-page.php:
<h1 class="bbp_entry-title"> <?php bbp_topic_title(); ?> </h1>
Will this customization withstand any kind of future theme or wordpress update or does it need to be placed in the child theme? If so, how to include in child theme?
August 17, 2020 at 5:24 am #1238350Hi,
You have to create a copy of the includes folder and of the loop-page.php file in the child theme in order keep the modifications after updating the theme.
Thank you for your patience.
Best regards,
IsmaelAugust 17, 2020 at 2:03 pm #1238496Hi Ismael,
thank you for your support. I copied the folder into child theme and copied only the one file loop-page.php into this folder. All the other file of the actual include folder do not need to be copied. Is this correct?
August 17, 2020 at 5:09 pm #1238558Hi P3T3R_0ne,
Yes, you just need to copy the file where you need to make changes.
Best regards,
VictoriaAugust 17, 2020 at 5:33 pm #1238574ok. thank you, you can mark this issue as solved.
August 17, 2020 at 5:34 pm #1238576Hi P3T3R_0ne,
Great :)
We are closing the thread.
If you need further assistance please let us know in a new one.
Best regards,
Victoria -
AuthorPosts
- The topic ‘Title on bbpress forum threads’ is closed to new replies.