Skip to content

Instantly share code, notes, and snippets.

@huzaifaarain
Last active December 2, 2018 13:27
Show Gist options
  • Save huzaifaarain/8a94423d4a57b67626a714ea68f7278f to your computer and use it in GitHub Desktop.
Save huzaifaarain/8a94423d4a57b67626a714ea68f7278f to your computer and use it in GitHub Desktop.
How to customize the markup of WP Navigation
add_filter('nav_menu_css_class', function($classes, $item, $args) {
if($args->theme_location == 'location') {
$classes[] = 'list-inline-item';
}
return $classes;
}, 1, 3);
add_filter( 'nav_menu_link_attributes', function( $atts, $item, $args ) {
if($args->theme_location == 'location') {
// code
}
return $atts;
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment