1435 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Microlancer Beta Tester
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.

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

Iz there Anyone, who can help me.

237 posts
  • Bangladesh
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Most Wanted Bounty Winner
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
dmsumon says

Iz there Anyone, who can help me.

Amio jante chai :)

1435 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Microlancer Beta Tester
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.

237 posts
  • Bangladesh
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Most Wanted Bounty Winner
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
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:
1435 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Microlancer Beta Tester
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

360 posts
  • Microlancer Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Most Wanted Bounty Winner
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
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
  • Sold between 10 000 and 50 000 dollars
  • Referred between 10 and 49 users
  • Bought between 10 and 49 items
  • Has been a member for 5-6 years
  • Exclusive Author
  • Microlancer Beta Tester
ChillThemes says
1435 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Microlancer Beta Tester
webdesignerart says

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

Thanks mate its bit help me.

237 posts
  • Bangladesh
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Most Wanted Bounty Winner
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
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