- // replace original walker `$item_output`
- /*
- * Anchor Nav
- */
- if ( get_field('anchor_link', $item->ID) ) {
- $slug = $slug;
- } else {
- $slug = get_field('anchor_target', $item->ID);
- }
- if (is_front_page()) {
- } else {
- $attributes .= !empty( $item->url ) ? ' href="'.esc_attr( get_bloginfo('url') ).'/#'.$slug.'"' : '';
- }
- $output .= '<li id="nav-menu-item-'. $item->ID . '" class="' . $depth_class_names . ' ' . $class_names . ' anchor-link">';
- } else {
- $output .= '<li id="nav-menu-item-'. $item->ID . '" class="' . $depth_class_names . ' ' . $class_names . '">';
- }
- $args->before,
- $attributes,
- $args->link_before,
- apply_filters( 'the_title', $item->title, $item->ID ),
- $args->link_after,
- $args->after
- );
- // build html
- $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
Recent Pastes