Skip to content

Instantly share code, notes, and snippets.

@ahaywood
Last active December 11, 2015 08:38
Show Gist options
  • Save ahaywood/4574672 to your computer and use it in GitHub Desktop.
Save ahaywood/4574672 to your computer and use it in GitHub Desktop.
PHP: WP - Create widget section
// ADD TO FUNCTIONS.PHP
if (function_exists('register_sidebar')) {
register_sidebar(array(
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h5>',
'after_title' => '<h5>',
))
}
// ADD TO ACTUAL FILE
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar()) : ?>
<!-- ONLY SHOWS IF THERE IS NOTHING IN THE WIDGET AREA -->
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment