Created
April 24, 2012 15:45
-
-
Save baczoni/2480866 to your computer and use it in GitHub Desktop.
Wordpress: Create widget areas
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
//Create widget areas | |
<?php | |
// In functions.php | |
register_sidebar(array( | |
'name' => 'Sidebar', | |
'id' => 'sidebar', | |
'before_widget' => '<li>', | |
'after_widget' => '</li>', | |
'before_title' => '<h3>', | |
'after_title' => '</h3>' | |
)); | |
register_sidebar(array( | |
'name' => 'Footer', | |
'id' => 'footer', | |
'before_widget' => '<li>', | |
'after_widget' => '</li>', | |
'before_title' => '<h3>', | |
'after_title' => '</h3>' | |
)); | |
// In sidebar.php | |
if ( is_sidebar_active('sidebar') ) { | |
dynamic_sidebar('sidebar'); | |
} | |
// In footer.php | |
if ( is_sidebar_active('footer') ) { | |
dynamic_sidebar('footer'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment