Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • in reply to: Reorder activity subnav #56990
     Ricardo
    Participant

    All right, after many trial and errors, I got it! As example, moving the subnav “Favorites” to the last position:

    COPY CODE
    
    function custom_bp_subnav_order() {
    	global $bp;
    	$domain = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain();
    	bp_core_new_subnav_item( array(
    		'name'            => _x( 'Favorites', 'Profile activity screen sub nav', 'buddypress' ),
    		'slug'            => 'favorites',
    		'parent_url'      => trailingslashit( $domain . bp_get_activity_slug() ),
    		'parent_slug'     => bp_get_activity_slug(),
    		'screen_function' => 'bp_activity_screen_favorites',
    		'position'        => 99,
    		'item_css_id'     => 'activity-favs'
    	) );
    }
    add_action( 'bp_setup_nav', 'custom_bp_subnav_order', 999 );
    

    Add it to the child theme’s function.php.

    Check function setup_nav() in /buddypress/bp-activity/bp-activity-loader.php to get the data for other subnav’s.

    R.

    in reply to: Reorder activity subnav #56976
     Ricardo
    Participant

    Thanks Laura, yes, I have previously seen this topic on Buddypress Forum, however, the only working solution provided on it is through editing the core code of Buddypress (specifically the function setup_nav()) in /buddypress/bp-activity/bp-activity-loader.php.

    I wonder if there is a way to do this adding code to the theme’s function.php file.

    R.

    in reply to: Remove Right Sidebar #55702
     Ricardo
    Participant

    Thanks Abe, your solution is better!

    in reply to: Remove Right Sidebar #55700
     Ricardo
    Participant

    This works to keep the right sidebar only on profile page.

    COPY CODE
    
    //remove sidebar for activity and groups pages
    add_action('kleo_before_page','my_remove_sidebar');
    function my_remove_sidebar() {
    	if(!bp_is_member()) {
    		remove_action('kleo_buddypress_after_content', 'kleo_buddypress_sidebar');
    		add_filter('kleo_buddypress_content_class', create_function('', 'return "twelve";'));
    	}
    }
    
    in reply to: Remove Right Sidebar #55693
     Ricardo
    Participant

    mmmm… Strange. The code looks logically fine but the member profile also had the right sidebar removed and turned full width… The intention is only activity and group pages full width. Any alternative for the “if” clause?

    This is the function for now:

    COPY CODE
    
    //remove right sidebar for activity and groups pages
    add_action('kleo_before_page','my_remove_sidebar');
    function my_remove_sidebar() {
    	if(bp_is_groups_component() || bp_is_activity_component()) {
    		remove_action('kleo_buddypress_after_content', 'kleo_buddypress_sidebar');
    		add_filter('kleo_buddypress_content_class', create_function('', 'return "twelve";'));
    	}
    }
    
    in reply to: Remove Right Sidebar #55671
     Ricardo
    Participant

    It doesn’t. I was looking at the code and found it out how to partially fix it.

    I couldn’t fix the commented line:

    COPY CODE
    
    //remove sidebar for activity and groups pages
    add_action('kleo_before_page','my_remove_sidebar');
    function my_remove_sidebar() {
    	if(bp_is_groups_component() || bp_is_activity_component()) {
    		remove_action('kleo_buddypress_after_content', 'kleo_buddypress_sidebar');
    		//add_filter('kleo_content_class', create_function('', 'return "twelve";')); //this does not work
    	}
    }
    
    in reply to: Remove Right Sidebar #55598
     Ricardo
    Participant

    This function does not work anymore. Could you tell the new one?

Viewing 7 posts - 1 through 7 (of 7 total)

Log in with your credentials

Forgot your details?