__( 'Global Navigation', 'arkhe' ),
'drawer_menu' => __( 'Inside the drawer menu', 'arkhe' ),
'footer_menu' => __( 'Footer', 'arkhe' ),
)
);
}
/**
* リストのHTMLを組み替える
* 例:「説明」を追加(ナビゲーションの英語テキストに使用)
*/
function hook_walker_nav_menu( $item_output, $item, $depth, $args ) {
// 特定のメニューに対して処理
$menu_location = $args->theme_location;
// サブメニューを持つかどうか
$has_child = in_array( 'menu-item-has-children', $item->classes, true );
if ( 'header_menu' === $menu_location || 'drawer_menu' === $menu_location ) {
if ( 0 === $depth ) {
$item_output = preg_replace(
'/]*)>([^<]*)<\/a>/',
'$2',
$item_output
);
if ( ! empty( $item->description ) ) {
$item_output = str_replace(
'',
'' . esc_html( $item->description ) . '',
$item_output
);
}
}
if ( $has_child ) {
$item_output = str_replace(
'',
ark_get__submenu_toggle_btn() . '',
$item_output
);
}
} elseif ( '' === $menu_location ) {
if ( $has_child ) {
$item_output = str_replace(
'',
ark_get__submenu_toggle_btn() . '',
$item_output
);
}
}
$item_output = do_shortcode( $item_output );
return $item_output;
}