Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*
* Add custom lightbox attribute to the menu
*/
function prefix_menu_item_extra_atts( $atts, $item, $args )
{
if ( $item->object_id == '977') {
$atts['data-optin-slug'] = 'qykfszblau-lightbox';
$atts['class'] = 'manual-optin-trigger';
}
return $atts;
}
add_filter( 'nav_menu_link_attributes', 'prefix_menu_item_extra_atts', 10, 3 );
@jasonleerogers
Copy link

jasonleerogers commented May 30, 2015

Where do we put this code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment