astra_menu_anchor_class_for_nav_menus( array $atts )

Add CSS classes for all menu links inside WP Nav menu items.


Description

Right now, if Addon is active we add ‘menu-link’ class through walker_nav_menu_start_el, but if only theme is being used no class is assigned to anchors.

As we are replacing tag based selector assets to class selector, adding ‘menu-link’ selector to all anchors inside menu items. Ex. .main-header-menu a => .main-header-menu .menu-link


Parameters

$atts

(array) (Required) An array of all parameters assigned to menu anchors.


Source

File: inc/markup-extras.php

function astra_menu_anchor_class_for_nav_menus( $atts ) {

	if ( ! empty( $atts['class'] ) ) {
		$atts['class'] = $atts['class'] . ' menu-link';
	} else {
		$atts['class'] = 'menu-link';
	}

	return $atts;
}

Changelog

Changelog
Version Description
2.5.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.