Last active
March 21, 2017 20:02
-
-
Save marcosnakamine/e50d0e160d75ee0cfeb407b6d5e0a268 to your computer and use it in GitHub Desktop.
WordPress - Add dynamic sidebar
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 | |
add_action( 'init', 'theme_widgets_init' ); | |
function theme_widgets_init() { | |
register_sidebar( array ( | |
'name' => 'Widget', | |
'id' => 'primary_widget_area', | |
'before_widget' => '<div id="%1$s" class="widget-container %2$s">', | |
'after_widget' => "</div>", | |
'before_title' => '<h3 class="widget-title">', | |
'after_title' => '</h3>', | |
) ); | |
} |
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 dynamic_sidebar('primary_widget_area'); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment