Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- register_nav_menus( array(
- 'primary' => 'Videos',
- 'secondary' => 'Site'
- ) );
- function my_walker_nav_menu_start_el($item_output, $item, $depth, $args) {
- $menu_locations = get_nav_menu_locations();
- if ( has_term($menu_locations['primary'], 'nav_menu', $item) ) {
- $item_output = preg_replace('/<a /', '<a class="list-group-item" ', $item_output, 1);
- }
- return $item_output;
- }
- add_filter('walker_nav_menu_start_el', 'my_walker_nav_menu_start_el', 10, 4);
- // In template
- <?php
- $menuParameters = array(
- 'menu' => 'Videos',
- 'container' => false,
- 'echo' => false,
- 'items_wrap' => '%3$s',
- 'depth' => 0
- );
- echo strip_tags(wp_nav_menu( $menuParameters ), '<a>' );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement