Widget above theme menu in sidebar
-
I am displaying my theme menu in the sidebar and would like to have a text widget displayed above the menu rather than below rather than below the menu.
Anyone have any ideas on this?
Thanks.
-
I’m also wondering about this…
Solution for that would be a custom child theme.
In your child theme’s functions.php add the following code:
<?php // our custom child functions go here function twentyfourteen_child_widgets_init() { register_sidebar( array( 'name' => __( 'Secondary Top Widget Area', 'twentyfourteen' ), 'id' => 'sidebar-0', 'description' => __( 'A widget area that appears on the left above the secondary navigation menu.', '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', 'twentyfourteen_child_widgets_init' );Copy sidebar.php from the parent theme in to your child theme and add the following code just above the line that reads
<?php if ( has_nav_menu( 'secondary' ) ) : ?><?php if ( is_active_sidebar( 'sidebar-0' ) ) : ?> <div id="primary-sidebar" class="primary-sidebar widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-0' ); ?> </div><!-- #primary-sidebar --> <?php endif; ?>Install and activate then visit the widget area and add widget(s) to the new location – these will always appear above the secondary menu.
Enjoy a free sample copy here: http://wpdefault.com/starter-child-theme/
Zulf.
Awesome, that worked! Thank you so much.
I’m new to this message board, but is there a way to give you… Upvotes or something?
You are most welcome.
I’m new to this message board, but is there a way to give you… Upvotes or something?
Would be awesome if there was such a system in place – but its the thought that counts 🙂
In terms of giving you could consider giving the theme a 5 star rating and leaving a nice review? 🙂
The topic ‘Widget above theme menu in sidebar’ is closed to new replies.
