WordPress.org

Support

Support » Themes and Templates » Adding a Widget Area

Adding a Widget Area

Viewing 3 replies - 1 through 3 (of 3 total)
  • Oh yes, I have been trying to figure this out for some time. That is exactly where I need a widget. Any help is much appreciated!

    After a bunch of research, I finally figured it all out. In the functions.php file I put the following code:

    function header_widgets_init() {
    
    	register_sidebar( array(
    		'name' => 'Below Navigation',
    		'id' => 'below_nav_widget',
    		'before_widget' => '<nav>',
    		'after_widget' => '</div>',
    		'before_title' => '<h2 class="rounded">',
    		'after_title' => '</h2>',
    	) );
    }
    add_action( 'widgets_init', 'header_widgets_init' );

    Then in the header.php file under my nav section I put:

    <?php if ( dynamic_sidebar('below_nav_widget') ) : else : endif; ?>

    And everything worked! Good luck!

    Thanks so much! This helped me add a few new widget areas.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding a Widget Area’ is closed to new replies.