Last active
October 4, 2015 02:28
-
-
Save eddiemoya/2562465 to your computer and use it in GitHub Desktop.
Basic Widgetized 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
<?php ## functions.php | |
/** | |
* This 'registers' the sidebar and tells WordPress it exists, as well as names it | |
* and gives it wrapping markup for each widget, and the title if applicable. | |
* | |
* Change the markup to meet your needs. | |
*/ | |
if (function_exists('register_sidebar')) { | |
register_sidebar(array( | |
'name' => 'Hero', | |
'description' => 'Hero section of the theme', | |
'before_widget' => '<div class="widget %2$s" id="%1$s">', | |
'after_widget' => '</div>', | |
'before_title' => '<h3 class="widgettitle">', | |
'after_title' => '</h3>' | |
)); | |
} | |
## whatever template your sidebar needs to be in. | |
/** | |
* This implements the sidebar, the string you pass should be the 'name' from when | |
* it was registered. | |
* | |
* The purpose of the wrapping condition is to allow for default content in case no | |
* widgets are added to the sidebar. | |
*/ | |
if ( !dynamic_sidebar('Sidebar') ) { | |
//default stuff that will be overridden if there is anything in the sidebar. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment