-
Author
-
November 30, 2013 at 00:42 #7472bananalustParticipant
I was looking at the functions.php file regarding sidebars
//get the global sidebar
if (!function_exists(‘kleo_sidebar’)):
function kleo_sidebar()
{
get_sidebar();
}
endif;//Buddypress SIDEBAR ACTION
if (sq_option(‘buddypress_sidebar’,’right’) == ‘left’)
{
add_action(‘kleo_buddypress_before_content’, ‘kleo_buddypress_sidebar’);
}
elseif (sq_option(‘buddypress_sidebar’,’right’) == ‘right’)
{
add_action(‘kleo_buddypress_after_content’, ‘kleo_buddypress_sidebar’);
}//get buddypress sidebar
if (!function_exists(‘kleo_buddypress_sidebar’)):
function kleo_buddypress_sidebar()
{
get_sidebar(‘buddypress’);
}
endif;I would like to add a function that calls a certain sidebar on the buddypress member profile page depending on an xprofile field
Here is an example
function hide_blog_from_community() {
$role = xprofile_get_field_data( ‘Membership’ );
//echo ‘role: ‘ . $role . ‘<br>’;
if( $role !=’Expert’ )
bp_core_remove_nav_item(‘blog’);
}
add_action( ‘bp_setup_nav’, ‘hide_blog_from_community’, 99 );So if the role is expert I would want to load sidebar-expert and if not I would like to load sidebar-community or the default sidebar. I can’t figure out where get_sidebar(‘buddypress’); is coming from????
Thank you for your insight and help on this!
December 1, 2013 at 01:44 #7524SQadminKeymasterHi, That is the code responsible with buddypress sidebar. You can check if is a profile page with this function: bp_is_member()
get_sidebar(‘buddypress’) looks for sidebar-buddypress.php file in the theme so you can create your own template
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.