Skip to content

Instantly share code, notes, and snippets.

@mediter mediter/wp_reg_sidebar.php
Last active Jul 11, 2018

Embed
What would you like to do?
[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
You can’t perform that action at this time.