• I am trying to add a widget area to my nav bar so I can use shortcode to put my social media icons there. Would this be the correct code to place in the header.php file?

    // Add a widget.
    if (function_exists('register_sidebar')) {
    	register_sidebar(array(
    	'name' => 'Extra Widget Before Header',
    	'id' => 'extra-widget',
    	'description' => 'Extra Widget Before Header',
    	'before_widget' => '<div id="%1$s" class="widget %2$s">',
    	'after_widget' => '</div>',
    	'before_title' => '<h2>',
    	'after_title' => '</h2>'
    	));
    }
    // Place the widget before the header
    add_filter ('__after_navbar', 'add_my_widget');
    	function add_my_widget() {
    		if (function_exists('dynamic_sidebar')) {
    		dynamic_sidebar('Extra Widget Before Header');
    		}
    	}

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add widget to nav area’ is closed to new replies.