Widget areas for Groups, Forums, etc
-
Hi Guys
How do I create widget zones for the different parts of BuddyPress?
eg, Id like the widgets on the Groups to be different from Forums, Members, HomePage, etc
-
good question…in old version bp1.1 we have the option to set first-section, second section,third section, blog-sidebar.
In new version I see everything merged into one side bar widget, so we can’t have separate items displayed in groups, forums etc.
apologies, but have to bump
what if i get down on my knee and beg?
In your theme/child theme, you just need to add new widget areas in, same as any regular WordPress theme. I’m not a theme expert but have a look at http://www.themelab.com/2008/04/18/see-how-easy-it-is-to-widgetize-wordpress-themes/ under “Multiple Widget Ready Areas”
Nice work, modemlooper. That’s gonna save me some time!
I’ve done this in a Child theme that will be released very soon.. I’ll try to share it here asap.
tx
@aronel Thats easy to do just create new sidebars for each and then create functions for each of those sidebars.
sidebar.php
sidebar-groups.php
in your groups theme folder switch out the code that calls sidebar.php and add sidebar-groups.php
You can also do this and create new zones on pages / slugs. Say at top of groups directory you want to have featured groups avatars. Easily done with widget zones.
InactiveI was going to post this as a new thread, but it’s related to this so thought I’d drop it in here first…feel free to move if you don’t think it’s relevant enough.
I was looking for a solution that allows me to have a different sidebar and set of widgets for different groups. I’m already using different sidebars for different BP components – but having a different sidebar on a group by group basis would be amazing!
It doesn’t need to be a feature that users can control, just for us admins
If this is possible, how?!!
Cheers
One approach that could work for you would be to place this in your sidebar.php perhaps after do_action(‘bp_after_sidebar_login_form) and use it to wrap a newly created widgit area as described I think earlier.
<?php if(bp_is_groups_component() && 'my-group-name' == bp_current_item()): ?>
<?php dynamic_sidebar( 'sidebar group page' ) ?>
<?php endif; ?>Or simply hard code stuff between the conditional. Of course there are undoubtedly other approaches one could take
This may be pertinent, but I am using the Widget Logic plugin to control widgets across my install. It’s been great but I’m not sure how to control the logic for BuddyPress pages or if it’s even possible.
For example, “!is_home() && is_user_logged_in()” allows me to place a widget in the sidebar anywhere but home where the user is logged in, but how might I use that logic to place it specifically on the Groups page, for example?
Thx
Not sure I understand your question but I use a variety of methods in sidebar.php to control what manifests.
It can call the sidebar widgit area under much the same circumstances you describe above it also allows for a number of new custom widget areas that I show on specific directory pages done like this:
<?php if ( BP_GROUPS_SLUG == bp_current_component() && bp_is_directory() ) : ?>
<?php dynamic_sidebar( 'sidebar group page' ) ?>
<?php endif; ?>Which I think is what you’re referring to? of course you can place anything within that group check doesn’t have to be dynamic_sidebar.
For example, “!is_home() && is_user_logged_in()” allows me to place a widget in the sidebar anywhere but home where the user is logged in, but how might I use that logic to place it specifically on the Groups page, for example?
have a look in bp-core-templatetags.php and under the section:
/* Template is_() functions to determine the current page */
There is a much easier way to do this. To have widgets only show up on certain pages I just use this plugin, Widget Logic: https://wordpress.org/extend/plugins/widget-logic/
Buddypress Sidebar! This plugin enables you to have multiple sidebars for Buddypress. Create new sidebars that are unique to each page.
Re: BuddyPress Sidebar
I can make it display things on blog pages, but how do I make it display things on normal static WP pages? I have checked the Show Component & Action thing in BP Sidebar but that doesn’t seem to help.
- The topic ‘Widget areas for Groups, Forums, etc’ is closed to new replies.