Last active
January 3, 2016 05:18
-
-
Save srikat/8414387 to your computer and use it in GitHub Desktop.
Using different sidebars for different Pages/Posts using labels in Dynamik. http://sridharkatakam.com/applying-different-sidebars-different-pagesposts-using-labels-dynamik/
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
// 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