WordPress.org

Forums

Adelle
Adding a Widget Area (4 posts)

  1. Genesee_Baker
    Member
    Posted 10 months ago #

    How do I go about adding in another widget area? I would like to add one below navigation before the content starts.

  2. stephanickety
    Member
    Posted 9 months ago #

    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!

  3. Genesee_Baker
    Member
    Posted 9 months ago #

    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!

  4. stephanickety
    Member
    Posted 9 months ago #

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

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.