芝麻web文件管理V1.00
编辑当前文件:/home/r5772835/public_html/dina.ycreate.jp/wp-content/themes/snow-monkey/app/setup/nav-menus.php
esc_html__( 'Global Navigation (For PC)', 'snow-monkey' ), 'drop-nav' => esc_html__( 'Drop Navigation (For PC)', 'snow-monkey' ), 'drawer-nav' => esc_html__( 'Drawer Navigation (For Mobile)', 'snow-monkey' ), 'social-nav' => esc_html__( 'Social Navigation', 'snow-monkey' ), 'follow-box' => esc_html__( 'Follow box', 'snow-monkey' ), 'header-sub-nav' => esc_html__( 'Header Sub Navigation', 'snow-monkey' ), 'footer-sub-nav' => esc_html__( 'Footer Sub Navigation', 'snow-monkey' ), 'drawer-sub-nav' => esc_html__( 'Drawer Sub Navigation (For Mobile)', 'snow-monkey' ), 'footer-sticky-nav' => esc_html__( 'Footer Sticky Navigation (For Mobile)', 'snow-monkey' ), ) ); } ); /** * Enqueue scripts * * @return void */ add_action( 'wp_enqueue_scripts', function() { wp_register_script( Helper::get_main_script_handle() . '-footer-sticky-nav', get_theme_file_uri( '/assets/js/footer-sticky-nav.js' ), array(), filemtime( get_theme_file_path( '/assets/js/footer-sticky-nav.js' ) ), true ); wp_register_script( Helper::get_main_script_handle() . '-global-nav', get_theme_file_uri( '/assets/js/global-nav.js' ), Helper::generate_script_dependencies( array( Helper::get_main_script_handle() . '-drop-nav', ) ), filemtime( get_theme_file_path( '/assets/js/global-nav.js' ) ), true ); if ( has_nav_menu( 'footer-sticky-nav' ) ) { wp_enqueue_script( Helper::get_main_script_handle() . '-footer-sticky-nav' ); } if ( has_nav_menu( 'global-nav' ) ) { wp_enqueue_script( Helper::get_main_script_handle() . '-global-nav' ); } }, 11 ); /** * Display description of nav item under it. * * @param string $title HTML * @param object $item * @param object $args * @param int $depth * @return string */ add_filter( 'nav_menu_item_title', function( $title, $item, $args, $depth ) { $show_description = 0 === (int) $depth && 'global-nav' === $args->theme_location; $show_description = apply_filters( 'snow_monkey_nav_menu_item_title_show_description', $show_description, $depth, $args->theme_location ); if ( ! $show_description ) { return $title; } $title = sprintf( '
%1$s
', $title ); if ( $item->description ) { $title = $title . sprintf( '
%1$s
', esc_html( $item->description ) ); } return $title; }, 10, 4 ); /** * Add highlight nsetting to nav menu items. */ add_action( 'after_setup_theme', function() { add_action( 'wp_nav_menu_item_custom_fields', function( $item_id ) { $highlight = get_post_meta( $item_id, 'sm-nav-menu-item-highlight', true ); ?>
/>
FILTER_REQUIRE_ARRAY, ) ); if ( $highlight && isset( $highlight[ $menu_item_db_id ] ) ) { update_post_meta( $menu_item_db_id, 'sm-nav-menu-item-highlight', $highlight[ $menu_item_db_id ] ); } else { delete_post_meta( $menu_item_db_id, 'sm-nav-menu-item-highlight' ); } }, 10, 2 ); add_filter( 'wp_nav_menu_objects', function( $sorted_menu_items ) { foreach ( $sorted_menu_items as $index => $item ) { $highlight = get_post_meta( $item->ID, 'sm-nav-menu-item-highlight', true ); if ( ! $highlight ) { continue; } $item->classes[] = 'sm-nav-menu-item-highlight'; $item->classes = array_unique( $item->classes ); $sorted_menu_items[ $index ] = $item; } return $sorted_menu_items; }, 10 ); } );