Created
December 10, 2019 01:13
-
-
Save KaineLabs/09216c16174e8dd3e3718b312f121ee7 to your computer and use it in GitHub Desktop.
Hide Widgets Settings By Profile Tab.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hide Widgets Settings By Profile Tab. | |
*/ | |
function yzc_hide_widgets_by_slug( $widgets ) { | |
// Get Tab Slug | |
$tab_slug = 'my-community'; | |
if ( bp_current_component() == $tab_slug ) { | |
$widgets = array( array( 'widget_id' => 'visible' ) ); | |
} else { | |
foreach ($widgets as $key => $value ) { | |
if ( $value == array( 'widget_id' => 'visible' ) ) { | |
unset( $widgets[ $key ] ); | |
} | |
} | |
} | |
return $widgets; | |
} | |
add_filter( 'yz_profile_sidebar_widgets', 'yzc_hide_widgets_by_slug' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment