Support » Theme: MesoColumn » Add widget to Top Menu
Add widget to Top Menu
-
Hi Richie, what’s the best way to add a widget to the top right corner of the Top Menu?
Example: http://www.thewholeworldisaplayground.com
I would like to display Social Media profiles in the top right corner of the Top Menu, just like the example above.
Thanks in advance.
-
create an empty php named it meso-custom-functions.php in wp-content/ and add this code
<?php function meso_add_new_widget() { register_sidebar(array( 'name'=>__('Top Menu', TEMPLATE_DOMAIN), 'id' => 'top-menu', 'description' => __( 'Top Menu widget area', TEMPLATE_DOMAIN ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<p>', 'after_title' => '</p>', )); } add_action( 'widgets_init', 'meso_add_new_widget', 10 ); function meso_add_top_menu_widget() { if ( is_active_sidebar( 'top_menu' ) ) { dynamic_sidebar( 'top_menu' ); } } add_action('bp_inside_top_nav','meso_add_top_menu_widget'); ?>
you will need to adjust the css style bit when the widget on top is active.
Hi Ritchie, I created meso-custom-functions.php in wp-content folder and added the code above.
After adding, I can see a Top Menu Widget Area in Appearance>Widgets…..but when I add widgets to it…it doesn’t show up in the Top Menu of my site..
I tried adding different widgets and cleared cache but nothing shows in the top right corner of the Top Menu.
function meso_add_top_menu_widget() { if ( is_active_sidebar( 'top-menu' ) ) { dynamic_sidebar( 'top-menu' ); } }
top_menu should be top-menu
sry my bad.Hi Ritchie, its working perfectly now. Thanks once again for your help.
Hi abcdefghijklmnop,
I’m trying to do something similar with this theme -using this thread for instructions. (Thanks Richie) However, I have a novice question about creating a .php file. How do I create an empty php?
Do I just create a document, insert this code and name it as a php extension?
Thanks 🙂
hi Trampolini, you should use a text editor to create a .php file (just name it .php)
becareful not to use MS Word etc to do this. make sure the program u use is a proper text editor, whether for windows or mac. i’m on mac so i’m using TextEdit which comes with every Mac. goodluck!
- The topic ‘Add widget to Top Menu’ is closed to new replies.