Genesis remove a widget area
-
Hello, I am using genesis theme the-411 which has no sidebars just a fixed widget area to the right showing social icons. The site is forced full width but the container sit at about 800px I am trying to remove that from showing on the forums page and instead show a a login for bbpress. Not sure how to go about doing this. I tried the If conditional tag on there but it does not seem to work.
here is the code
//* Hook social icons and click here widget areas
add_action( ‘genesis_after_header’, ‘the_411_extras’, ‘genesis_after_sidebar_widget_area’ );
function the_411_extras() {if ( is_active_sidebar( ‘social-icons’ ) || is_active_sidebar( ‘click-here’ ) || is_active_sidebar( ‘split-sidebar-left’ ) || is_active_sidebar( ‘split-sidebar-right’ )) {
echo ‘<div class=”site-extras”>’;
genesis_widget_area( ‘social-icons’, array(
‘before’ => ‘<div class=”social-icons”>’,
‘after’ => ‘</div>’
) );genesis_widget_area( ‘click-here’, array(
‘before’ => ‘<div class=”click-here”>’,
‘after’ => ‘</div>’
) );
genesis_widget_area( ‘split-sidebar-left’, array(
‘before’ => ‘<div class=”split-sidebar-left”>’,
‘after’ => ‘</div>’,
) );
genesis_widget_area( ‘split-sidebar-right’, array(
‘before’ => ‘<div class=”split-sidebar-right”>’,
‘after’ => ‘</div>’,
) );echo ‘</div>’;
if (is_bbpress( ‘forums’ ) ) {
/** Remove default sidebar */
remove_action( ‘genesis_after_sidebar_widget_area’ );
}}
}
I added the split right and left, but I only use the right for search box. Thanks!
-
I tried the If conditional tag on there but it does not seem to work.
do you mean
if (is_bbpress() )…
?
yes that one. I tried that. doesn’t do anything
so did you try it as that, or as
if (is_bbpress( ‘forums’ ) ) {is_bbpress doesn’t take arguments
I tried it as that
ok, thanks for confirming.
Without spending considerable time testing, why not just take out that entire section for bbpress (and if needed juts put back the bits you want) eg
//* Hook social icons and click here widget areas add_action( ‘genesis_after_header’, ‘the_411_extras’, ‘genesis_after_sidebar_widget_area’ ); function the_411_extras() { if (!is_bbpress { if ( is_active_sidebar( ‘social-icons’ ) || is_active_sidebar( ‘click-here’ ) || is_active_sidebar( ‘split-sidebar-left’ ) || is_active_sidebar( ‘split-sidebar-right’ )) { echo ‘<div class=”site-extras”>’; genesis_widget_area( ‘social-icons’, array( ‘before’ => ‘<div class=”social-icons”>’, ‘after’ => ‘</div>’ ) ); genesis_widget_area( ‘click-here’, array( ‘before’ => ‘<div class=”click-here”>’, ‘after’ => ‘</div>’ ) ); genesis_widget_area( ‘split-sidebar-left’, array( ‘before’ => ‘<div class=”split-sidebar-left”>’, ‘after’ => ‘</div>’, ) ); genesis_widget_area( ‘split-sidebar-right’, array( ‘before’ => ‘<div class=”split-sidebar-right”>’, ‘after’ => ‘</div>’, ) ); echo ‘</div>’; } } }
I’m also not sure why your add action has two functions
add_action( ‘genesis_after_header’, ‘the_411_extras’, ‘genesis_after_sidebar_widget_area’ );
all the coding I have ever done has one, and then maybe some arguments on priority etc.
thanks. I tried that and it did not work.
I also tried
if (!is_bbpress ())
remove_action ( ‘genesis_after_header’, ‘the_411_extras’, ‘genesis_after_sidebar_widget_area’ );
if ( is_active_sidebar( ‘social-icons’ ) || is_active_sidebar( ‘click-here’ ) || is_active_sidebar( ‘split-sidebar-left’ ) || is_active_sidebar( ‘split-sidebar-right’ )) {and
if (!is_bbpress (‘forums’))if ( is_active_sidebar( ‘social-icons’ ) || is_active_sidebar( ‘click-here’ ) || is_active_sidebar( ‘split-sidebar-left’ ) || is_active_sidebar( ‘split-sidebar-right’ )) {
with and without the forums part. nothing seems to remove it.
ok, so you need to determine if it is the is_bbpress that is the issue. If you just have the other code does it work – ie is the issue with the other code or the conditional?
It’s with the conditional, I have the sticky social icons on the right side on all my pages fixed. Don’t know if that is causing it to stay cause I just can’t seem to remove it from the forums pages, are there any alternatives to displaying a login section? As I said this genesis child theme does not have a registered sidebar, however I went in and registed the primary and secondary sidebar just so I could get the log in on there, but with that fixed widget in the way, it just pushes that sidebar off the left of the sticky widget.
I finally got it to go away like this
if (is_bbpress ())
if ( is_active_sidebar( ‘social-icons’ ) || is_active_sidebar( ‘click-here’ ) || is_active_sidebar( ‘split-sidebar-left’ ) || is_active_sidebar( ‘split-sidebar-right’ )) {
but it removes it sitewide
I am trying to remove that from showing on the forums page and instead show a a login for bbpress.
This forum page you say, is it just the original forum index page at /forums, or is this a page that you inserted the forum index shortcode to create “forum page”??
The
is_bbpress()
conditional may not work if you went the shortcode in a page route.Well unless you made sure the pages slug was the same slug as the forum root, but even with that I feel like that odd procedure could cause issues.
Ah yes I did go the shortcode route. So what other ways are there, I did not see another option. thanks
I was just pointing out that its possible that you may need to use another conditional as well if you did create a “forum page”.
So you would possibly need another conditional for a user created “forum page”. If you didn’t already make sure that the “forum page” was set to have the same page slug as the default forums slug in your site set in Settings > Forums.
An example of the additional conditional you would use would be
is_page{1}
where “1” is the specific page ID of your “forums page”.if (!is_bbpress() || is_page(1) ) {
You can also use is_page(‘forums’) as well instead.
https://developer.wordpress.org/reference/functions/is_page/
I usually do not say use a “forums page” as it is not recommended during setup, but it could be useful to workaround bugs that I think usually happens when using a Genesis theme, but I guess use it until the bug is fixed in bbPress/Genesis. Well if there is still a bug.
I would contact your theme developers support since you have a paid theme, and they can help you better since they understand the code in that specific theme, and only if you really want to dig into the code and modify it like your trying to do, or you can just use a plugin like Widget Logic to use a conditional to hide/display widgets depending on certain conditionals like is_bbpress() and is_page{}.
I usually do not say use a “forums page” as it is not recommended during setup
1. Can’t see where it is not recommended -Indeed in dashboard>settings>forums it says “Customise your Forums root. Partner with a WordPress Page and use Shortcodes for more flexibility.”
2. There’s a massive difference between recommending something and saying ‘it is not recommended’ As far as I know bbPress is just neutral – either works fine.
Its not recommended during a setup of bbPress.
In most cases, unless there is a forum archive bug from the theme/bbPress theme compatibility, its not a requirement for a forum site.
It could be a possible recommendation for further customization, but a lot has to be laid out before then in a guide somewhere in customizing section or theme development (like I told in my email to you) so users do not come across possible issues.
If you want to debate any pros and cons of creating a “forum page” you can go ahead and email me and we can discuss that, and what I emailed you before about moving your guides content into other sections.
By me, its my opinion that first time users/beginners should not create a “forum page” right now until there is a guide that could outline the possible issues users might encounter while creating it.
If you want to make a forum page an initial part during bbPress setup, then you would need to create a ticket in the trac. It could be possible to make it similar to how Woocommerce shop page is setup to avoid most of the user generated issues.
Also we are probably going to split this into a new topic. If you want to talk to me further about this like I said you can email me.
That’s fine – just wanted to clarify that this is just one person’s opinion.
Also we are probably going to split this into a new topic
Not sure who the ‘we’ is in this sentence?
Oh no problem Robin. 🙂
I should have stated its just my opinion that we should try to help users that may come across “forum page” related issues by creating a guide in the codex to better explain how to do it, and show how helpful it would be, but more importantly stop all these similar issues users would get that I see in these forums all the time, so that us moderators do not have to repeat ourselves or try to guess what could be causing an issue.
You can either change recommended in my earlier statement with required. As it is not required during setup. I am sometimes terrible at choosing the right words to explain what I mean. Great that you pointed that out Robin!
And although yes, it is recommended for further customization of a users forums in the settings. Like I said, my opinion is that the “forum page” is not recommended, until most of the user generated issues are laid out with possible solutions for users in a new guide, and either we or anyone that wants to can make a trac ticket to avoid these type of issues all together, and improve the bbPress plugin user experience.
I would like to talk to you privately through email if you have time, about improving your codex guides also, and I do not want to butt heads with you over just some guides.
Edit: Created the ticket https://bbpress.trac.wordpress.org/ticket/2993
- You must be logged in to reply to this topic.