Problem adding a widget above header
-
I added this to my child theme functions.
<?php // 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 ('__before_header', 'add_my_widget'); function add_my_widget() { if (function_exists('dynamic_sidebar')) { dynamic_sidebar('Extra Widget Before Header'); } }It added the widget above header to my widget menu with no problem but whatever I put there does not publish to the blog.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Problem adding a widget above header’ is closed to new replies.