• Resolved Soebye

    (@soebye)


    Hi, I am trying to assign a custom css class to menu items, in order to get the dropdown menu (secondary) to be in two columns instead of just one.
    However, the css classes i input does not show in the site.
    The site i am working on is in maintenance mode, so providing a link wont help much, but here it is:
    https://www.byloui.dk
    Is there anything in the theme which may remove added css classes to menu items?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hey soebye,
    Yes in fact the theme does change this. The reason is to integrate a way to add icons. see here: https://www.kadencethemes.com/add-icons-to-your-menu-virtue-theme/

    You can change this in a child theme, or if your just wanting to select one menu item you can use the unique class that is part of the menu already. Every menu item has a class that goes like: menu-item-965

    Kadence Themes

    Thread Starter Soebye

    (@soebye)

    Okay, i just wanted to have one class assigned to all items in the whole dropdown menu. How do i disable this in the childtheme?

    Thank you!

    There is already a dropdown menu class fyi,

    In your child theme add this to your child themes functions.php file:

    remove_filter('wp_nav_menu_args', 'kadence_nav_menu_args');

    Kadence Themes

    Thread Starter Soebye

    (@soebye)

    Hi, thank you for your support. I need to add a class to the individual items in the dropdown menu, in order to get it to be in two columns.
    And the code you sent does not work, unfortunately. The CSS class i have assigned to the menu item still does not show. I have attached two screenshots, one where i have entered the CSS class, and one where you can see that the class clearly does not show on the live site.

    View post on imgur.com

    Thank you!

    Hmm could be being called to early switch that out for this:

    add_action('init', 'kt_remove_nav_args');
    function kt_remove_nav_args(){
    remove_filter('wp_nav_menu_args', 'kadence_nav_menu_args');
    }

    Kadence Themes

    Thread Starter Soebye

    (@soebye)

    That did it. Now the costum class work, and i can get it to be in two columns. Thank you very much!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘optional CSS class to menu items not working’ is closed to new replies.