Plugin Author
Eric
(@emartin24)
Do you happen to know the WP function that is used to generate the menu?
I need to research and see about adding a filter into the function to add the class.
Hi Eric, thanks for the swift response.
I think you mean wp_nav_menu…
I’ve copied in the code from the header.php (I’m not using a sub-navigation).
`<?php
if(function_exists(‘wp_nav_menu’)) {
wp_nav_menu( array( ‘theme_location’ => ‘main’, ‘menu_class’ => ‘sf-menu’,’sort_column’ => ‘menu_order’, ‘container_class’ => ‘main-navigation’, ‘fallback_cb’ => ‘display_home’ ) );
wp_nav_menu( array( ‘theme_location’ => ‘sub’, ‘sort_column’ => ‘menu_order’, ‘container_class’ => ‘sub-navigation’, ‘fallback_cb’ => ‘display_none’ ) );
} else {
echo ‘<div class=”main-navigation”><ul class=”sf-menu”><li><a href=”‘.get_bloginfo(‘url’).'”>Home</a></li>’;
wp_list_categories(‘title_li=’);
echo ‘</ul></div>’;
}
?>`
This is how it outputs (just showing the contact page li):
<div class="main-navigation"><ul id="menu-main-menu" class="sf-menu"><li id="menu-item-16" class="menu-item menu-item-type-taxonomy menu-item-16"><a href="(myurl)/contact/">Contact</a></li></ul></div>
Any ideas?
Plugin Author
Eric
(@emartin24)
Here’s a quick fix. Open smcf.php and below
add_filter('wp_list_pages', array($smcf, "page_menu_list"));
Add:
add_filter('wp_nav_menu_items', array($smcf, "page_menu_list"));
Then, on your Appearance > Menus page, make sure the Contact menu has a title attribute that matches the Contact Link Title: value on your SMCF settings page.
That should do the trick. If not, let me know…
Good day all! I have a problem.
I use wp_nav_menu( array( ‘container’ => ‘table’,
‘container_class’>’table_menu’,
‘menu_class’ => ‘menu’, ‘menu_id’ => ‘topnav’, ‘depth’ => 0, ‘theme_location’ => ‘mainmenu’,
‘walker’ => new description_walker()));
And i can’t insert Contact to it menu.
my walker it:
add_filter(‘wp_page_menu’, array($smcf, “page_menu_list”));
add_filter(‘wp_list_pages’, array($smcf, “page_menu_list”));
and adding add_filter(‘wp_nav_menu_items’, array($smcf, “page_menu_list”)); doesn’t work. Please help.
Plugin Author
Eric
(@emartin24)
In order for it to work, your link needs to include the smcf-link class, or the title attribute needs to be “Contact” (or whatever value you have specified in your SMCF options).