-
-
Save About2git/ff44eb10d91962dd4b0b to your computer and use it in GitHub Desktop.
Using different sidebars for different Pages/Posts using labels in Dynamik
This file contains hidden or 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
// Switch sidebars | |
add_action( 'get_header', 'change_genesis_sidebar' ); | |
function change_genesis_sidebar() { | |
if ( dynamik_has_label('leads') || dynamik_has_label('prospects') || dynamik_has_label('customers') ) { | |
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); | |
add_action( 'genesis_sidebar', 'sk_do_sidebar' ); | |
} | |
} | |
/** | |
* Set custom sidebar | |
*/ | |
function sk_do_sidebar() { | |
if ( dynamik_has_label('leads') ) { | |
echo do_shortcode( '[leads_sidebar]' ); | |
} | |
elseif ( dynamik_has_label('prospects') ) { | |
echo do_shortcode( '[prospects_sidebar]' ); | |
} | |
elseif ( dynamik_has_label('customers') ) { | |
echo do_shortcode( '[customers_sidebar]' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment