Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonschr/a9cf963e28505895bdeb to your computer and use it in GitHub Desktop.
Save jonschr/a9cf963e28505895bdeb to your computer and use it in GitHub Desktop.
/*
* 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

Where do we put this code?

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