bellows_link_attributes

The bellows_link_attributes filter has the same definition as the WordPress core nav_menu_link_attributes filter, but only affects Bellows menu items. It is provided as a simple way to target just Bellows menus when filtering link attributes.

Examples

Add a custom class to your links

In this example, we add append a custom class, my-class, to the anchor:

add_action( 'bellows_link_attributes' , 'bellows_filter_link_class' , 10 , 3);
function bellows_filter_link_class( $atts , $item , $args ){
	$atts['class'].= ' my-class';
	return $atts;
}

Add custom data attributes to your link

In this example, we add a data-id and data-type attribute to the anchor:

add_action( 'bellows_link_attributes' , 'bellows_link_attributes_custom_data' , 10 , 3);
function bellows_link_attributes_custom_data( $atts , $item , $args ){
	$atts['data-id'] = $item->object_id;
	$atts['data-type'] = $item->object;

	return $atts;
}

On this page