Jump to content

Archived

This topic is now archived and is closed to further replies.

Slsp

Display Hook in NavBar ?

Recommended Posts

Slsp

Trying to insert small form (which shortcode is [mc4wp_form] ) into the fixed navbar. So far the only solution i came up with was adding the shortcode to a wp_nav_menu_items menu, which div does this belong and which hook would I call so I dont mess with the dms php files ?

 

// Cretion of the filter

add_filter('wp_nav_menu_items','be_menu_extras', 10, 2);

 

function be_menu_extras($menu, $args) {
        $small_form = do_shortcode( '[mc4wp_form]' );
        $menu = $menu . $small_form;

 

       // Add the Facebook and Twitter buttons
       $extras = do_shortcode( '<li class="menu-item menu-item-type-custom menu-item-object-custom">Contact</li>' );
       return $menu . $extras;
}

 

This is in child theme functions php

 

Attached is the image of what I am trying to achieve

 

Thanks

Share this post


Link to post
Share on other sites
James B

Hi there, the DMS navbar has four hooks you could use depending where you want the form to display. Looking at the your screenshot I would go for the before_menu.

 

pagelines_navbar_before_menu

pagelines_navbar_before_search

pagelines_navbar_after_search

pagelines_navbar_after_menu


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites

×