Viewing 6 replies - 1 through 6 (of 6 total)
  • Theme Author Richie KS

    (@rkcorp)

    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.

    Thread Starter abcdefghijklmnop

    (@abcdefghijklmnop)

    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.

    Theme Author Richie KS

    (@rkcorp)

    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.

    Thread Starter abcdefghijklmnop

    (@abcdefghijklmnop)

    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 ??

    Thread Starter abcdefghijklmnop

    (@abcdefghijklmnop)

    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!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add widget to Top Menu’ is closed to new replies.