文件操作 - menu.php
返回文件管理
返回主菜单
删除本文件
文件: /storage/v12552/jimbrandstatter/public_html/wp-content/themes/Total/inc/header/menu.php
编辑文件内容
<?php declare(strict_types=1); namespace TotalTheme\Header; \defined( 'ABSPATH' ) || exit; /** * Header Menu. */ class Menu { /** * Header menu is enabled or not. */ protected static $is_enabled; /** * Header menu is custom check. */ protected static $is_custom; /** * Static-only class. */ private function __construct() {} /** * Returns the theme_location for the header menu. */ public static function get_theme_location(): string { $location = 'main_menu'; /** * Filters the header menu location. * * @param string $location */ $location = \apply_filters( 'totaltheme/header/menu/theme_location', $location ); /*** deprecated ***/ $location = \apply_filters( 'wpex_main_menu_location', $location ); return (string) $location; } /** * Returns a menu ID, slug, name, or object. */ public static function get_wp_menu() { $menu = \get_post_meta( \wpex_get_current_post_id(), 'wpex_custom_menu', true ); if ( 'default' === $menu ) { $menu = ''; } $menu = \apply_filters( 'totaltheme/header/menu/wp_menu', $menu ); /*** deprecated ***/ $menu = \apply_filters( 'wpex_custom_menu', $menu ); return $menu; } /** * Checks if the header menu is enabled or not. */ public static function is_enabled(): bool { if ( ! \is_null( self::$is_enabled ) ) { return self::$is_enabled; } if ( ! \totaltheme_call_static( 'Header\Core', 'is_enabled' ) || \totaltheme_call_static( 'Header\Core', 'is_custom' ) ) { self::$is_enabled = false; return self::$is_enabled; } // Check meta first and don't pass through filters. $meta_check = \get_post_meta( \wpex_get_current_post_id(), 'wpex_header_menu', true ); if ( $meta_check ) { self::$is_enabled = \wpex_validate_boolean( $meta_check ); return self::$is_enabled; } $check = self::has_menu(); /** * Filters whether the site has the header enabled. * * @param bool $check */ $check = \apply_filters( 'totaltheme/header/menu/is_enabled', $check ); /*** deprecated ***/ $check = \apply_filters( 'wpex_has_header_menu', $check ); self::$is_enabled = (bool) $check; return self::$is_enabled; } /** * Checks if a menu is assigned. */ protected static function multisite_check(): bool { $check = \apply_filters( 'totaltheme/header/menu/multisite_check', false ); /*** deprecated ***/ $check = \apply_filters( 'wpex_ms_global_menu', $check ); return (bool) $check; } /** * Checks if a menu is assigned. */ public static function has_menu(): bool { return ( \has_nav_menu( self::get_theme_location() ) || self::get_wp_menu() || self::multisite_check() ); } /** * Checks if the header menu is custom. */ public static function is_custom(): bool { if ( ! \is_null( self::$is_custom ) ) { return self::$is_custom; } $header_menu_location = self::get_theme_location(); $check = false; if ( \function_exists( '\max_mega_menu_is_enabled' ) && \max_mega_menu_is_enabled( $header_menu_location ) ) { $check = true; } if ( \function_exists( '\ubermenu_get_menu_instance_by_theme_location' ) && \ubermenu_get_menu_instance_by_theme_location( $header_menu_location ) ) { $check = true; } /** * Checks if the header menu is set to a custom display such as the dev header or a custom menu plugin header. * * @param bool $check */ $check = \apply_filters( 'totaltheme/header/menu/is_custom', $check ); /*** deprecated ***/ $check = \apply_filters( 'wpex_is_header_menu_custom', $check ); self::$is_custom = (bool) $check; return self::$is_custom; } /** * Returns the header menu dropdown method. */ public static function get_dropdown_method(): string { $method = get_theme_mod( 'menu_dropdown_method' ); /** * Filters the header menu dropdown method. * * @param string $method. */ $method = apply_filters( 'totaltheme/header/menu/dropdown_method', $method ); if ( ! $method ) { $method = 'hover'; } return (string) $method; } /** * Returns the header menu dropdown style. */ public static function get_dropdown_style(): string { $style = get_theme_mod( 'menu_dropdown_style' ); $post_id = wpex_get_current_post_id(); if ( $post_id && totaltheme_call_static( 'Header\Overlay', 'is_enabled' ) && wpex_has_post_meta( 'wpex_overlay_header' ) ) { $meta = get_post_meta( $post_id, 'wpex_overlay_header_dropdown_style', true ); if ( $meta ) { $style = $meta; } } /** * Filters the header menu dropdown style. * * @param string $style. */ $style = apply_filters( 'totaltheme/header/menu/dropdown_style', $style ); /*** deprecated ***/ $style = apply_filters( 'wpex_header_menu_dropdown_style', $style ); if ( 'default' === $style ) { $style = ''; // prevent having to make this check in other places. } return (string) $style; } /** * Checks if the header menu has flush dropdowns (aka full height menu items). */ public static function has_flush_dropdowns(): bool { $check = false; $supported_header_styles = [ 'one', 'seven', 'eight', 'nine', 'ten', ]; if ( \get_theme_mod( 'menu_flush_dropdowns' ) && \in_array( totaltheme_call_static( 'Header\Core', 'style' ), $supported_header_styles ) ) { $check = true; } /** * Filters if the header menu has flush dropdowns. * * @param boolean $check */ $check = \apply_filters( 'totaltheme/header/menu/has_flush_dropdowns', $check ); /*** deprecated ***/ $check = \apply_filters( 'wpex_has_header_menu_flush_dropdowns', $check ); return (bool) $check; } /** * Renders the header menu via wp_nav_menu. */ public static function wp_nav_menu(): void { $menu_args = [ 'theme_location' => self::get_theme_location(), 'container' => false, 'fallback_cb' => false, 'menu_class' => \wpex_header_menu_ul_classes(), 'link_before' => '<span class="link-inner">', 'link_after' => '</span>', ]; if ( \class_exists( '\WPEX_Dropdown_Walker_Nav_Menu' ) ) { $menu_args['walker'] = new \WPEX_Dropdown_Walker_Nav_Menu(); } if ( $wp_menu = self::get_wp_menu() ) { $menu_args['menu'] = $wp_menu; } /*** deprecated - you should just hook into wp_nav_menu_args ***/ $menu_args = \apply_filters( 'wpex_header_menu_args', $menu_args ); if ( \is_multisite() && self::multisite_check() ) { \switch_to_blog( 1 ); \wp_nav_menu( (array) $menu_args ); \restore_current_blog(); } else { \wp_nav_menu( (array) $menu_args ); } } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件