1749 posts
  • 4 Years of Membership
  • Beta Tester
  • Collector Level 2
  • Exclusive Author
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.

1749 posts
  • 4 Years of Membership
  • Beta Tester
  • Collector Level 2
  • Exclusive Author
webdesignerart
says

Iz there Anyone, who can help me.

248 posts
  • 4 Years of Membership
  • Affiliate Level 2
  • Author Level 5
  • Collector Level 1
+2 more
dmsumon
says

Iz there Anyone, who can help me.

Amio jante chai :)

1749 posts
  • 4 Years of Membership
  • Beta Tester
  • Collector Level 2
  • Exclusive Author
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.

248 posts
  • 4 Years of Membership
  • Affiliate Level 2
  • Author Level 5
  • Collector Level 1
+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:
1749 posts
  • 4 Years of Membership
  • Beta Tester
  • Collector Level 2
  • Exclusive Author
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

408 posts
  • Author Level 6
  • Exclusive Author
  • Most Wanted Winner
  • Beta Tester
+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

709 posts
  • Affiliate Level 2
  • Author Level 5
  • Beta Tester
  • Collector Level 2
+2 more
ChillThemes
says
1749 posts
  • 4 Years of Membership
  • Beta Tester
  • Collector Level 2
  • Exclusive Author
webdesignerart
says

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

Thanks mate its bit help me.

248 posts
  • 4 Years of Membership
  • Affiliate Level 2
  • Author Level 5
  • Collector Level 1
+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