Add Widget Area to Header Twenty Thirteen
-
Looking at the examples of several tutorials and the code in Twenty Thirteen I have come up with something that breaks my site. This is what I have in my child theme:
In the header.php, any possible place, I have tried to add:
<?php get_sidebar( 'sidebar-head' ); ?>
along with this file I named sidebar-head.php:
<?php /** * The sidebar containing the header widget area * */ if ( is_active_sidebar( 'sidebar-head' ) ) : ?> <div id="secondary" class="sidebar-container" role="complementary"> <div class="widget-area"> <?php dynamic_sidebar( 'sidebar-head' ); ?> </div><!-- .widget-area --> </div><!-- #secondary --> <?php endif; ?>
And I have this to add to functions.php which breaks it:
function twentythirteen_widgets_init() { register_sidebar( array( 'name' => __( 'Head Widget Area', 'twentythirteen' ), 'id' => 'sidebar-head', 'description' => __( 'Appears in the header section of the site.', 'twentythirteen' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); } add_action( 'widgets_init', 'twentythirteen_widgets_init' );
I have tried the above code with and without this:
add_action( 'widgets_init', 'twentythirteen_widgets_init' );
and with and without this:
function twentythirteen_widgets_init() {
I have also tried using both of those and neither of those (with and without the { })…any help would really be appreciated.
**This is the site I’m working on, right now I’ve deleted all of that not working code above.
- The topic ‘Add Widget Area to Header Twenty Thirteen’ is closed to new replies.