feat: Improve button styles and update nav-contact class handling for better consistency

This commit is contained in:
Matt Batchelder
2026-02-26 07:27:04 -05:00
parent abd670322b
commit 7f8c0e32e4
2 changed files with 10 additions and 8 deletions

View File

@@ -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 );