Created
July 10, 2022 18:41
-
-
Save frontend-coder/c2681837dda65903ad2616f8adaca014 to your computer and use it in GitHub Desktop.
35. Додати можливість додавати класи к li меню wordpress #wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
finction domein_add_class_onli($classes, $item, $args) { | |
if(isset ($args-> add_li_class ) ) { | |
$classes[] = $args-> add_li_class; | |
} | |
return $classes; | |
} | |
add_filter('nav_menu_css_class', 'domein_add_class_onli', 1,3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
wp_nav_menu( | |
array( | |
'theme_location' => 'header_nav', | |
'container'=>'', | |
'add_li_class' => 'nav_item nav_link' | |
) | |
) | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment