feat: Improve button styles and update nav-contact class handling for better consistency
This commit is contained in:
@@ -85,18 +85,17 @@ add_filter( 'nav_menu_link_attributes', function ( $atts, $item, $args ) {
|
||||
/**
|
||||
* Add nav-contact class to Contact menu item's list element.
|
||||
*/
|
||||
add_filter( 'nav_menu_li_attributes', function ( $atts, $item, $args, $depth ) {
|
||||
add_filter( 'nav_menu_css_class', function ( $classes, $item, $args, $depth ) {
|
||||
// Only apply to the primary menu
|
||||
if ( $args->theme_location !== 'primary' ) {
|
||||
return $atts;
|
||||
return $classes;
|
||||
}
|
||||
|
||||
// Check if this is the Contact menu item (by URL or title)
|
||||
if ( strpos( $item->url, 'contact' ) !== false || $item->title === 'Contact' ) {
|
||||
// Add nav-contact class
|
||||
$atts['class'] = isset( $atts['class'] ) ? $atts['class'] . ' nav-contact' : 'nav-contact';
|
||||
$classes[] = 'nav-contact';
|
||||
}
|
||||
|
||||
return $atts;
|
||||
return $classes;
|
||||
}, 10, 4 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user