Rudchyk
4/25/2018 - 1:28 PM

WP Nav Menu

<?php
add_theme_support( 'menus' );

register_nav_menus(
  array(
    'header-menu' => __('Header Menu'),
  )
);
?>
<?php
add_filter( 'wp_nav_menu_items','add_last_nav_item');

function add_last_nav_item($items) {
  $items = '<li class="menu-item menu-item--home"><a href="/"><i class="material-icons">home</i></a></li>'.$items;
  return $items;
}
?>
<?php
add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );

function my_wp_nav_menu_args($args='') {
  $args['container'] = '';
  $args['depth'] = '1';
  $args['fallback_cb'] = '__return_empty_string';
  return $args;
}
?>
<?php
add_filter( 'nav_menu_link_attributes', 'my_wp_nav_menu_footer_filter', 10, 4);

function my_wp_nav_menu_footer_filter($atts, $item, $args, $depth){
  if($args->menu == 'bottom') {
    $atts['class'] = 'grey-text text-lighten-3';
  }
  return $atts;
}
?>