Skip to content

Instantly share code, notes, and snippets.

@mediter
Last active July 11, 2018 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mediter/ed42889d702d2125f7f12209ff5e219f to your computer and use it in GitHub Desktop.
Save mediter/ed42889d702d2125f7f12209ff5e219f to your computer and use it in GitHub Desktop.
[WordPress Sidebars] #WordPress #PHP #sidebar
register sidebar in functions.php
registering a sidebar is just defining a container
if( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'spage',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
}
use sidebar in templates
<?php if ( is_active_sidebar( 'footer-widget' ) ) :
dynamic_sidebar( 'footer-widget' );
endif
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment