How can you create a widget in the header area??
-
I’m trying to create a widget and have it place in the header area next to my logo. Max dimensions for that area I can have are 750×150 if that matters.
Creating the widget is not so much the problem, I used:
<div id="left"> <?php if ( is_active_sidebar( 'sidebar-left' ) ) : ?> <div id="left-sidebar" class="left-sidebar widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-left' ); ?> </div> <?php endif; ?> </div>
In a file I created called sidebar-left.php and this:
function mychild_widgets_init() { register_sidebar( array( 'name' => __( 'Left Widget Area', 'twentyfourteen' ), 'id' => 'sidebar-left', 'description' => __( 'Left sidebar.', 'twentyfourteen' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h1 class="widget-title">', 'after_title' => '</h1>', ) ); } add_action( 'widgets_init', 'mychild_widgets_init' );
In the functions file to create a new widget on the left but I don’t know how to implement this code into the header in order to have a widget there..
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How can you create a widget in the header area??’ is closed to new replies.