1635 posts
  • Has been part of the Envato Community for over 3 years
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
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
  • Has referred 200+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
mabuc says

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

1635 posts
  • Has been part of the Envato Community for over 3 years
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
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
  • Has referred 200+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
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 ) );
1635 posts
  • Has been part of the Envato Community for over 3 years
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
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