• Hi

    I am having an issue with Hueman and Buddypress. I can select sidebars/layout in the Theme Options for the various WP area i.e Page, Archive etc and everything appears as expected. However, when I try to assign a custom sidebar/layout on the individual page assigned to Buddypress, it does not override the settings in the Theme Options.

    My other plugin assigned to pages work fine and I can assign any sidebar/layout to a specific page. I am assuming that is because they are using is_page. I have tried to add the following to my functions.php but it changes nothing. Please be aware I am a code hack so this is probably incorrect and more of a guess.

    /*  Dynamic sidebar primary for Buddypress
    /* ------------------------------------ */
    if ( ! function_exists( 'alx_sidebar_primary_bp' ) ) {
    function alx_sidebar_primary_bp() {
    		// Default sidebar
    		$sidebar = 'primary';
    
    		// Set sidebar based on page
    		if ( is_buddypress() && ot_get_option('s1-page') ) $sidebar = ot_get_option('s1-page');
    
    		// Check for page/post specific sidebar
    		if ( is_buddypress() || is_single() ) {
    			// Reset post data
    			wp_reset_postdata();
    			global $post;
    			// Get meta
    			$meta = get_post_meta($post->ID,'_sidebar_primary',true);
    			if ( $meta ) { $sidebar = $meta; }
    		}
    
    		// Return sidebar
    		return $sidebar;
    	}
    }
    /*  Dynamic sidebar secondary for Buddypress
    /* ------------------------------------ */
    if ( ! function_exists( 'alx_sidebar_secondary_bp' ) ) {
    function alx_sidebar_secondary_bp() {
    		// Default sidebar
    		$sidebar = 'secondary';
    
    		// Set sidebar based on page
    		if ( is_buddypress() && ot_get_option('s2-page') ) $sidebar = ot_get_option('s2-page');
    
    		// Check for page/post specific sidebar
    		if ( is_buddypress() || is_single() ) {
    			// Reset post data
    			wp_reset_postdata();
    			global $post;
    			// Get meta
    			$meta = get_post_meta($post->ID,'_sidebar_secondary',true);
    			if ( $meta ) { $sidebar = $meta; }
    		}
    
    		// Return sidebar
    		return $sidebar;
    	}
    	}

    Could anyone correct this/point me in the right direction. I need to be able to display a “social” sidebar for my Buddypress pages.

    Many thanks in advance for any help!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Buddpress – assigning sidebar/layout directly for BP page’ is closed to new replies.