1531 posts
  • Bought between 10 and 49 items
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 3-4 years
webdesignerart says

Hi guys i made class for current menu item its work fine but on home my product page like automatically add current-menu-ancestor current-menu-parent class why its showing on menu these extra class. I already add home page link its work fine and asigning current page link but the prodcut page is also highlighting in home page.

So anyone idea which things maybe causing this issue.

1179 posts
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 200 and 499 users
  • Has been a member for 6-7 years
mabuc says

are you using a menu fallback? or the custom menu?

1531 posts
  • Bought between 10 and 49 items
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 3-4 years
webdesignerart says

are you using a menu fallback? or the custom menu?
$walker = new My_Walker;
            wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu, 'container' => false, 'walker' => $walker ) );
Menu fallback.
1179 posts
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 200 and 499 users
  • Has been a member for 6-7 years
mabuc says


are you using a menu fallback? or the custom menu?
$walker = new My_Walker;
            wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu, 'container' => false, 'walker' => $walker ) );
Menu fallback.

try this: I hope this helps :)

function menu_fallback() {
        if(is_front_page()){ $class="current_page_item"; }
        ?>
        <div class="menu">
            <ul>
                <li class="<?php echo $class; ?>">
                    <a href="<?php echo home_url(); ?>">Home</a>
                </li>
                <?php wp_list_pages(); ?>
            </ul>
        </div>
        <?php
    }
$walker = new My_Walker;
            wp_nav_menu( array( 'fallback_cb' => 'menu_fallback', 'menu' => $nav_menu, 'container' => false, 'walker' => $walker ) );
1531 posts
  • Bought between 10 and 49 items
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 3-4 years
webdesignerart says



are you using a menu fallback? or the custom menu?
$walker = new My_Walker;
            wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu, 'container' => false, 'walker' => $walker ) );
Menu fallback.

try this: I hope this helps :)

function menu_fallback() {
        if(is_front_page()){ $class="current_page_item"; }
        ?>
        <div class="menu">
            <ul>
                <li class="<?php echo $class; ?>">
                    <a href="<?php echo home_url(); ?>">Home</a>
                </li>
                <?php wp_list_pages(); ?>
            </ul>
        </div>
        <?php
    }
$walker = new My_Walker;
            wp_nav_menu( array( 'fallback_cb' => 'menu_fallback', 'menu' => $nav_menu, 'container' => false, 'walker' => $walker ) );

Thanks for your help, but it will not working in my senario because i am using jquery mega menu plugin which call through widget option.

 if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('main_mega_menu') ) : ?>
by
by
by
by
by
by