Where is registered the forum sidebar?
-
Hello!
I have a client who wants to display the bbpress sidebar in the forum pages in a different way.
He want to make it narrow and with smaller fonts.the problem is that the bbpress sidebar is registered with no particular wrapper id, so if I edit the css, all the sidebars in the website will be changed and not only the forum one.
I am looking to find the file where the sidebar is registered, in order to alter the code and add a specific id (like #bbpress-sidebar) to the sidebar, so I’ll be able to make a custom css for the sidebar sub-classes only for the children of that id.
I’ve looked into millions of files but I haven’t found it, can someone please help me?
Thanx!
Andrea
-
Does the body tag have a class of .bbPress ?
If so you can use that to target the sidebar.
Hi there!
Thanx for answering! I’ve read your answer to a similar issue in an old post and I’ve already checked that, but unfortunately it seems that in the new versions, or at least in this installation, the bbpress class is added to the body of the post content and not to the page wrapper, so the sidebar is outside and I can’t target it with that class..
it’s a bit weird though, cause it seems that the shortcode which calls the forum archive in the post content, is actually overriding the template chosen with the page attributes. it’s set as default template, but in the theme default page should be displayed the default sidebar, and in the forum page is displaying the forum sidebar instead, even if is set on default template and there is just a shortcode into the post content..
There are numerous ways of doing this:
You can use a conditional to check
is_bbpress()
Make some copies of your templates for example and make a copy of
page.php
file and rename it tobbpress.php
and call a specific sidebar template egbbpress-sidebar.php
from yourbbpress.php
template.Ok, Thank you Stephen!
That’s going to be a very handy function! 🙂I’ll try it and let you know.
Thanx in advance for your help!
Andreaok, it works perfectly!
in this way I’ll be able to edit the page template and set a different class for content and sidebar in order to have a smaller sidebar and a larger space for the forums.
and I’ll be able to call different sidebars in editing the sidebar.php of my template.
thank you very much!
piccart can u link me to what you did? I’m thinking of doing something like this eventually
Cool 🙂 Drop a link to the forums in https://bbpress.org/forums/forum/pimp-your-press/ once you’ve finished, would love to take a look 🙂
Hi guys! sorry but I forgot to pin the notifications for this post so I just realized about your replies..
it wasn’t very technical actually, but I think it depends a lot on the theme you have.
if just added a conditional into the class of my page template main content and of the sidebar wrap:
<?php if (is_bbpress() || is_page('forum')){ echo "forum_layout"; } ?>
it will have to be added something like this:
<div class="grid__item main float--left <?php if (is_bbpress() || is_page('forum')){ echo "forum_layout"; } ?>">
then is all about css, so it depends on yours. but you should be able to override the interested divs, appending your .forum_layout class in this way:
.grid__item.main.forum_layout { width:76%; } .grid__item.sidebar.forum_layout { width:24%; }
then at the same you can override the normal layout fonts, colours, etc.. if something is not considering your new style, try adding !important in this way:
width:24% !important;
hope that’ll help! 😉
- You must be logged in to reply to this topic.