1578 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 friends,

I want to know iz there any way to remove classes just only from cutom links, Atleast i want to remove these classes from my custom links “current-menu-ancestor current-menu-parent” not from dynamic links.

I use this pease of code:

add_filter('nav_menu_css_class', 'my_css_attributes_filter', 100, 1);
add_filter('nav_menu_item_id', 'my_css_attributes_filter', 100, 1);
add_filter('page_css_class', 'my_css_attributes_filter', 100, 1);
function my_css_attributes_filter($var) {
    return is_array($var) ? array_intersect($var, array('current-menu-ancestor current-menu-parent')) : '';
}

it removing css class from all static and dynamic links. i just want to remove css classes from custom links.

Any idea friends.

1578 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

Iz there Anyone, who can help me.

242 posts
  • Has been part of the Envato Community for over 3 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+2 more
dmsumon says

Iz there Anyone, who can help me.

Amio jante chai :)

1578 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

Friends i found solution but i remove classes from all links i just want to remove class from specific link class or link id:

add_filter('nav_menu_css_class', 'my_css_attributes_filter', 100, 1);
add_filter('nav_menu_item_id', 'my_css_attributes_filter', 100, 1);
add_filter('page_css_class', 'my_css_attributes_filter', 100, 1);
function my_css_attributes_filter($classes) {
    // if this is not a custom link and not the home page, return the $classes intact, otherwise filter $classes 
    return is_array($classes) ? 
        (in_array("menu-item-object-avanza_serv_page", $classes) || is_home())? 
            array_intersect($classes, array('current-menu-ancestor current-menu-parent'))
            : $classes // not a custom link
        : ''; // not an array
}

The “menu-item-object-avanza_serv_page” is the class of link which i am going to remove its class.

But this code snipe remove all links classes. not specific.

242 posts
  • Has been part of the Envato Community for over 3 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+2 more
dmsumon says

Friends i found solution but i remove classes from all links i just want to remove class from specific link class or link id:
add_filter('nav_menu_css_class', 'my_css_attributes_filter', 100, 1);
add_filter('nav_menu_item_id', 'my_css_attributes_filter', 100, 1);
add_filter('page_css_class', 'my_css_attributes_filter', 100, 1);
function my_css_attributes_filter($classes) {
    // if this is not a custom link and not the home page, return the $classes intact, otherwise filter $classes 
    return is_array($classes) ? 
        (in_array("menu-item-object-avanza_serv_page", $classes) || is_home())? 
            array_intersect($classes, array('current-menu-ancestor current-menu-parent'))
            : $classes // not a custom link
        : ''; // not an array
}

The “menu-item-object-avanza_serv_page” is the class of link which i am going to remove its class.

But this code snipe remove all links classes. not specific.
Chomotkar… Zodi tor dak shuney keu na ashey tobey ekla cholorey, ekla cholo, ekla cholo, ekla cholo raaaaay :nerdy:
1578 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


Friends i found solution but i remove classes from all links i just want to remove class from specific link class or link id:
add_filter('nav_menu_css_class', 'my_css_attributes_filter', 100, 1);
add_filter('nav_menu_item_id', 'my_css_attributes_filter', 100, 1);
add_filter('page_css_class', 'my_css_attributes_filter', 100, 1);
function my_css_attributes_filter($classes) {
    // if this is not a custom link and not the home page, return the $classes intact, otherwise filter $classes 
    return is_array($classes) ? 
        (in_array("menu-item-object-avanza_serv_page", $classes) || is_home())? 
            array_intersect($classes, array('current-menu-ancestor current-menu-parent'))
            : $classes // not a custom link
        : ''; // not an array
}

The “menu-item-object-avanza_serv_page” is the class of link which i am going to remove its class.

But this code snipe remove all links classes. not specific.
Ami abaro jante chai :nerdy:

I am not understanding your language :P

380 posts
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has been part of the Envato Community for over 4 years
  • Sells items exclusively on Envato Market
+2 more
kaaz says
Chomotkar… Zodi tor dak shuney keu na ashey tobey ekla cholorey, ekla cholo, ekla cholo, ekla cholo raaaaay :nerdy:

translate : amazing… if no one comes after listening you, go alone go alone go alone go alone

I don’t know the language(i speak odia) but i guess, its the meaning

707 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+2 more
ChillThemes says
1578 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

Try this: http://pastebin.com/W16cxDfY

Thanks mate its bit help me.

242 posts
  • Has been part of the Envato Community for over 3 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+2 more
dmsumon says

Chomotkar… Zodi tor dak shuney keu na ashey tobey ekla cholorey, ekla cholo, ekla cholo, ekla cholo raaaaay :nerdy:

translate : amazing… if no one comes after listening you, go alone go alone go alone go alone

I don’t know the language(i speak odia) but i guess, its the meaning

kaaz@ How did u translate it?? Google translate??? Actually it is a inspiring song in our country and I thought “webdesignerart” is from my country. :nerdy:

by
by
by
by
by
by