芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/ebpt.pulsehost.co.uk/wp-content/themes/maxcoach/framework/class-static.php
isTablet(); } public static function is_mobile() { if ( ! class_exists( 'Mobile_Detect' ) ) { return false; } if ( self::is_tablet() ) { return false; } return Mobile_Detect::instance()->isMobile(); } public static function is_handheld() { return ( self::is_mobile() || self::is_tablet() ); } public static function is_desktop() { return ! self::is_handheld(); } /** * Get settings for Kirki * * @param string $option_name * @param string $default * * @return mixed */ public static function setting( $option_name = '', $default = '' ) { $value = Maxcoach_Kirki::get_option( 'theme', $option_name ); $value = $value === null ? $default : $value; return $value; } /** * Primary Menu */ public static function menu_primary( $args = array() ) { $menu_class = 'menu__container sm sm-simple'; if ( MAXCOACH_IS_RTL ) { $menu_class .= ' sm-rtl'; } $defaults = array( 'theme_location' => 'primary', 'container' => 'ul', 'menu_class' => $menu_class, 'extra_class' => '', ); if ( $defaults['extra_class'] ) { $defaults['menu_class'] .= ' ' . $defaults['extra_class']; } $args = wp_parse_args( $args, $defaults ); if ( has_nav_menu( 'primary' ) && class_exists( 'Maxcoach_Walker_Nav_Menu' ) ) { $args['walker'] = new Maxcoach_Walker_Nav_Menu; } $menu = Maxcoach_Helper::get_post_meta( 'menu_display', '' ); if ( $menu !== '' ) { $args['menu'] = $menu; } wp_nav_menu( $args ); } /** * Off Canvas Menu */ public static function off_canvas_menu_primary() { self::menu_primary( array( 'menu_class' => 'menu__container', 'menu_id' => 'off-canvas-menu-primary', ) ); } /** * Mobile Menu */ public static function menu_mobile_primary() { self::menu_primary( array( 'menu_class' => 'menu__container', 'menu_id' => 'mobile-menu-primary', ) ); } /** * Logo */ public static function branding_logo() { $logo_dark_url = Maxcoach_Helper::get_post_meta( 'custom_dark_logo', '' ); $logo_light_url = Maxcoach_Helper::get_post_meta( 'custom_light_logo', '' ); $logo_width = intval( Maxcoach::setting( 'logo_width' ) ); $retina_width = $logo_width * 2; $sticky_logo_skin = Maxcoach::setting( 'header_sticky_logo' ); $header_logo_skin = Maxcoach_Global::instance()->get_header_skin(); if ( '' === $logo_dark_url ) { $logo_dark = Maxcoach::setting( 'logo_dark' ); if ( isset( $logo_dark['id'] ) ) { $logo_dark_url = Maxcoach_Image::get_attachment_url_by_id( array( 'id' => $logo_dark['id'], 'size' => "{$retina_width}x9999", 'crop' => false, ) ); } else { $logo_dark_url = $logo_dark['url']; } } if ( '' === $logo_light_url ) { $logo_light = Maxcoach::setting( 'logo_light' ); if ( isset( $logo_light['id'] ) ) { $logo_light_url = Maxcoach_Image::get_attachment_url_by_id( array( 'id' => $logo_light['id'], 'size' => "{$retina_width}x9999", 'crop' => false, ) ); } else { $logo_light_url = $logo_light['url']; } } $has_both_skin = false; if ( $sticky_logo_skin !== $header_logo_skin || is_page_template( 'templates/one-page-scroll.php' ) ) { $has_both_skin = true; } $alt = get_bloginfo( 'name', 'display' ); ?>
$value ) { $attrs_string .= " {$attr}=" . '"' . esc_attr( $value ) . '"'; } } echo '' . $attrs_string; } /** * Adds custom classes to the branding. */ public static function branding_class( $class = '' ) { $classes = array( 'branding' ); if ( ! empty( $class ) ) { if ( ! is_array( $class ) ) { $class = preg_split( '#\s+#', $class ); } $classes = array_merge( $classes, $class ); } else { // Ensure that we always coerce class to being an array. $class = array(); } $classes = apply_filters( 'maxcoach_branding_class', $classes, $class ); echo 'class="' . esc_attr( join( ' ', $classes ) ) . '"'; } /** * Adds custom classes to the navigation. */ public static function navigation_class( $class = '' ) { $classes = array( 'navigation page-navigation' ); if ( ! empty( $class ) ) { if ( ! is_array( $class ) ) { $class = preg_split( '#\s+#', $class ); } $classes = array_merge( $classes, $class ); } else { // Ensure that we always coerce class to being an array. $class = array(); } $classes = apply_filters( 'maxcoach_navigation_class', $classes, $class ); echo 'class="' . esc_attr( join( ' ', $classes ) ) . '"'; } }