Customized wp_nav_menu() (35 posts)

  1. Marventus
    Posted 3 years ago #

    Faster? yes, but also, more resource-intensive. Plus, Regex's are not recommended for parsing HTML code.
    My 2 cents.

  2. Arie Putranto
    Posted 3 years ago #

    Yup, nothing wrong with your two cents. But in this case, with not too large string to work with, and simply just getting rid of the classes and ID's, my way should be a proper way.

  3. nils chr.
    Posted 3 years ago #

    Hi, new here. But I saw there was talk about "add a custom CSS class to an LI item"...
    The best way to do this would be a jQuery selector.css at page load, in my opinion.

  4. nils chr.
    Posted 3 years ago #

    By the way.. in Norway we have a saying about "the shoes of the shoemaker's children". And the response utilities here could be better... can I say this ? ref http://www.bloghog.no

  5. Arie Putranto
    Posted 2 years ago #

    Me myself would rather be avoiding too much use of jQuery for what can be done server side. And adding css class to the menu is way simpler than using jQuery by using filter:

    add_filter( 'nav_menu_css_class', 'filter_nav_menu_css_class', 10, 2 );
    function filter_nav_menu_css_class( $classes, $item ) {
    /* Do something here */

Topic Closed

This topic has been closed to new replies.

About this Topic