__( 'Off Canvas Menu', 'gp-premium' ), ) ); } } if ( ! function_exists( 'generate_menu_plus_get_defaults' ) ) { /** * Set default options */ function generate_menu_plus_get_defaults() { return apply_filters( 'generate_menu_plus_option_defaults', array( 'mobile_menu_label' => __( 'Menu', 'gp-premium' ), 'sticky_menu' => 'false', 'sticky_menu_effect' => 'fade', 'sticky_menu_logo' => '', // Deprecated since 1.8. 'sticky_menu_logo_position' => 'sticky-menu', // Deprecated since 1.8. 'mobile_header' => 'disable', 'mobile_menu_breakpoint' => '768', 'mobile_header_logo' => '', 'mobile_header_sticky' => 'disable', 'mobile_header_branding' => 'logo', 'slideout_menu' => 'false', 'off_canvas_desktop_toggle_label' => '', 'slideout_menu_side' => 'left', 'slideout_menu_style' => 'slide', 'slideout_close_button' => 'outside', 'auto_hide_sticky' => false, 'mobile_header_auto_hide_sticky' => false, 'sticky_navigation_logo' => '', 'navigation_as_header' => false, ) ); } } add_filter( 'generate_color_option_defaults', 'generate_menu_plus_color_defaults' ); /** * Set the Menu Plus color defaults * * @since 1.6 */ function generate_menu_plus_color_defaults( $defaults ) { $defaults['slideout_background_color'] = ''; $defaults['slideout_text_color'] = ''; $defaults['slideout_background_hover_color'] = ''; $defaults['slideout_text_hover_color'] = ''; $defaults['slideout_background_current_color'] = ''; $defaults['slideout_text_current_color'] = ''; $defaults['slideout_submenu_background_color'] = ''; $defaults['slideout_submenu_text_color'] = ''; $defaults['slideout_submenu_background_hover_color'] = ''; $defaults['slideout_submenu_text_hover_color'] = ''; $defaults['slideout_submenu_background_current_color'] = ''; $defaults['slideout_submenu_text_current_color'] = ''; return $defaults; } add_filter( 'generate_font_option_defaults', 'generate_menu_plus_typography_defaults' ); /** * Set the Menu Plus typography option defaults. * * @since 1.6 */ function generate_menu_plus_typography_defaults( $defaults ) { $defaults['slideout_font_weight'] = 'normal'; $defaults['slideout_font_transform'] = 'none'; $defaults['slideout_font_size'] = ''; $defaults['slideout_mobile_font_size'] = ''; return $defaults; } if ( ! function_exists( 'generate_menu_plus_customize_register' ) ) { add_action( 'customize_register', 'generate_menu_plus_customize_register', 100 ); /** * Initiate Customizer controls */ function generate_menu_plus_customize_register( $wp_customize ) { // Get our defaults $defaults = generate_menu_plus_get_defaults(); $settings = wp_parse_args( get_option( 'generate_menu_plus_settings', array() ), generate_menu_plus_get_defaults() ); // Get our Customizer helpers require_once GP_LIBRARY_DIRECTORY . 'customizer-helpers.php'; if ( method_exists( $wp_customize, 'register_control_type' ) ) { $wp_customize->register_control_type( 'GeneratePress_Action_Button_Control' ); $wp_customize->register_control_type( 'GeneratePress_Section_Shortcut_Control' ); $wp_customize->register_control_type( 'GeneratePress_Pro_Range_Slider_Control' ); $wp_customize->register_control_type( 'GeneratePress_Information_Customize_Control' ); } // Add our old Menu Plus panel // This panel shouldn't display anymore but is left for back compat if ( class_exists( 'WP_Customize_Panel' ) ) { if ( ! $wp_customize->get_panel( 'generate_menu_plus' ) ) { $wp_customize->add_panel( 'generate_menu_plus', array( 'priority' => 50, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => esc_html__( 'Menu Plus', 'gp-premium' ), 'description' => '', ) ); } } // Add our options to the Layout panel if it exists // The layout panel is in the free theme, so we have the fallback in case people haven't updated if ( $wp_customize->get_panel( 'generate_layout_panel' ) ) { $panel = 'generate_layout_panel'; $navigation_section = 'generate_layout_navigation'; $header_section = 'generate_layout_header'; $sticky_menu_section = 'generate_layout_navigation'; } else { $panel = 'generate_menu_plus'; $navigation_section = 'menu_plus_section'; $header_section = 'menu_plus_mobile_header'; $sticky_menu_section = 'menu_plus_sticky_menu'; } // Add Menu Plus section // This section shouldn't display anymore for the above reasons $wp_customize->add_section( 'menu_plus_section', array( 'title' => esc_html__( 'General Settings', 'gp-premium' ), 'capability' => 'edit_theme_options', 'panel' => 'generate_menu_plus' ) ); // Mobile menu label $wp_customize->add_setting( 'generate_menu_plus_settings[mobile_menu_label]', array( 'default' => $defaults['mobile_menu_label'], 'type' => 'option', 'sanitize_callback' => 'wp_kses_post' ) ); $wp_customize->add_control( 'mobile_menu_label_control', array( 'label' => esc_html__( 'Mobile Menu Label', 'gp-premium' ), 'section' => $navigation_section, 'settings' => 'generate_menu_plus_settings[mobile_menu_label]' ) ); $wp_customize->add_setting( 'generate_menu_plus_settings[mobile_menu_breakpoint]', array( 'default' => $defaults['mobile_menu_breakpoint'], 'type' => 'option', 'sanitize_callback' => 'absint', ) ); if ( defined( 'GENERATE_VERSION' ) && version_compare( GENERATE_VERSION, '2.3-alpha.1', '>=' ) ) { $wp_customize->add_control( new GeneratePress_Pro_Range_Slider_Control( $wp_customize, 'generate_menu_plus_settings[mobile_menu_breakpoint]', array( 'label' => esc_html__( 'Mobile Menu Breakpoint', 'gp-premium' ), 'section' => $navigation_section, 'settings' => array( 'desktop' => 'generate_menu_plus_settings[mobile_menu_breakpoint]', ), 'choices' => array( 'desktop' => array( 'min' => 0, 'max' => 2000, 'step' => 5, 'edit' => true, 'unit' => 'px', ), ), ) ) ); } // Sticky menu section $wp_customize->add_section( 'menu_plus_sticky_menu', array( 'title' => esc_html__( 'Sticky Navigation', 'gp-premium' ), 'capability' => 'edit_theme_options', 'panel' => $panel, 'priority' => 33 ) ); // Sticky menu $wp_customize->add_setting( 'generate_menu_plus_settings[sticky_menu]', array( 'default' => $defaults['sticky_menu'], 'type' => 'option', 'sanitize_callback' => 'generate_premium_sanitize_choices' ) ); $wp_customize->add_control( 'generate_menu_plus_settings[sticky_menu]', array( 'type' => 'select', 'label' => esc_html__( 'Sticky Navigation', 'gp-premium' ), 'section' => 'menu_plus_sticky_menu', 'choices' => array( 'mobile' => esc_html__( 'Mobile only', 'gp-premium' ), 'desktop' => esc_html__( 'Desktop only', 'gp-premium' ), 'true' => esc_html__( 'On', 'gp-premium' ), 'false' => esc_html__( 'Off', 'gp-premium' ) ), 'settings' => 'generate_menu_plus_settings[sticky_menu]', 'priority' => 105 ) ); // Transition $wp_customize->add_setting( 'generate_menu_plus_settings[sticky_menu_effect]', array( 'default' => $defaults['sticky_menu_effect'], 'type' => 'option', 'sanitize_callback' => 'generate_premium_sanitize_choices' ) ); $wp_customize->add_control( 'generate_menu_plus_settings[sticky_menu_effect]', array( 'type' => 'select', 'label' => esc_html__( 'Transition', 'gp-premium' ), 'section' => 'menu_plus_sticky_menu', 'choices' => array( 'fade' => esc_html__( 'Fade', 'gp-premium' ), 'slide' => esc_html__( 'Slide', 'gp-premium' ), 'none' => esc_html__( 'None', 'gp-premium' ) ), 'settings' => 'generate_menu_plus_settings[sticky_menu_effect]', 'active_callback' => 'generate_sticky_navigation_activated', 'priority' => 110 ) ); // Auto hide on scroll down $wp_customize->add_setting( 'generate_menu_plus_settings[auto_hide_sticky]', array( 'default' => $defaults['auto_hide_sticky'], 'type' => 'option', 'sanitize_callback' => 'generate_premium_sanitize_checkbox' ) ); $wp_customize->add_control( 'generate_menu_plus_settings[auto_hide_sticky]', array( 'type' => 'checkbox', 'label' => esc_html__( 'Hide when scrolling down', 'gp-premium' ), 'section' => 'menu_plus_sticky_menu', 'settings' => 'generate_menu_plus_settings[auto_hide_sticky]', 'priority' => 120, 'active_callback' => 'generate_sticky_navigation_activated', ) ); if ( '' == $settings['sticky_menu_logo'] ) { // Navigation logo $wp_customize->add_setting( 'generate_menu_plus_settings[sticky_navigation_logo]', array( 'default' => $defaults['sticky_navigation_logo'], 'type' => 'option', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'generate_menu_plus_settings[sticky_navigation_logo]', array( 'label' => esc_html__( 'Sticky Navigation Logo', 'gp-premium' ), 'section' => 'menu_plus_sticky_menu', 'settings' => 'generate_menu_plus_settings[sticky_navigation_logo]', 'priority' => 125, 'active_callback' => 'generate_sticky_navigation_activated', ) ) ); } // Deprecated as of 1.8 if ( '' !== $settings['sticky_menu_logo'] ) { // Navigation logo $wp_customize->add_setting( 'generate_menu_plus_settings[sticky_menu_logo]', array( 'default' => $defaults['sticky_menu_logo'], 'type' => 'option', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'generate_menu_plus_settings[sticky_menu_logo]', array( 'label' => esc_html__( 'Navigation Logo', 'gp-premium' ), 'section' => $sticky_menu_section, 'settings' => 'generate_menu_plus_settings[sticky_menu_logo]', 'priority' => 115 ) ) ); // Logo placement $wp_customize->add_setting( 'generate_menu_plus_settings[sticky_menu_logo_position]', array( 'default' => $defaults['sticky_menu_logo_position'], 'type' => 'option', 'sanitize_callback' => 'generate_premium_sanitize_choices', ) ); $wp_customize->add_control( 'generate_menu_plus_settings[sticky_menu_logo_position]', array( 'type' => 'select', 'label' => esc_html__( 'Navigation Logo Placement', 'gp-premium' ), 'section' => $sticky_menu_section, 'choices' => array( 'sticky-menu' => esc_html__( 'Sticky', 'gp-premium' ), 'menu' => esc_html__( 'Sticky + Static', 'gp-premium' ), 'regular-menu' => esc_html__( 'Static', 'gp-premium' ) ), 'settings' => 'generate_menu_plus_settings[sticky_menu_logo_position]', 'priority' => 120, 'active_callback' => 'generate_navigation_logo_activated', ) ); } // Mobile Header section // No longer displays $wp_customize->add_section( 'menu_plus_mobile_header', array( 'title' => esc_html__( 'Mobile Header', 'gp-premium' ), 'capability' => 'edit_theme_options', 'panel' => $panel, 'priority' => 11 ) ); if ( '' == $settings['sticky_menu_logo'] ) { $wp_customize->add_setting( 'generate_menu_plus_settings[navigation_as_header]', array( 'default' => $defaults['navigation_as_header'], 'type' => 'option', 'sanitize_callback' => 'generate_premium_sanitize_checkbox', ) ); $wp_customize->add_control( 'generate_menu_plus_settings[navigation_as_header]', array( 'type' => 'checkbox', 'label' => esc_html__( 'Use Navigation as Header', 'gp-premium' ), 'section' => $header_section, 'settings' => 'generate_menu_plus_settings[navigation_as_header]', ) ); } // Mobile header $wp_customize->add_setting( 'generate_menu_plus_settings[mobile_header]', array( 'default' => $defaults['mobile_header'], 'type' => 'option', 'sanitize_callback' => 'generate_premium_sanitize_choices' ) ); $wp_customize->add_control( 'generate_menu_plus_settings[mobile_header]', array( 'type' => 'select', 'label' => esc_html__( 'Mobile Header', 'gp-premium' ), 'section' => $header_section, 'choices' => array( 'disable' => esc_html__( 'Off', 'gp-premium' ), 'enable' => esc_html__( 'On', 'gp-premium' ) ), 'settings' => 'generate_menu_plus_settings[mobile_header]', ) ); if ( defined( 'GENERATE_VERSION' ) && version_compare( GENERATE_VERSION, '2.3-alpha.1', '<' ) ) { $wp_customize->add_control( new GeneratePress_Pro_Range_Slider_Control( $wp_customize, 'generate_menu_plus_settings[mobile_menu_breakpoint]', array( 'label' => esc_html__( 'Breakpoint', 'gp-premium' ), 'section' => $header_section, 'settings' => array( 'desktop' => 'generate_menu_plus_settings[mobile_menu_breakpoint]', ), 'choices' => array( 'desktop' => array( 'min' => 768, 'max' => 2000, 'step' => 5, 'edit' => true, 'unit' => 'px', ), ), 'active_callback' => 'generate_mobile_header_activated', ) ) ); } $wp_customize->add_setting( 'generate_menu_plus_settings[mobile_header_branding]', array( 'default' => $defaults['mobile_header_branding'], 'type' => 'option', 'sanitize_callback' => 'generate_premium_sanitize_choices' ) ); $wp_customize->add_control( 'generate_menu_plus_settings[mobile_header_branding]', array( 'type' => 'select', 'label' => esc_html__( 'Branding Type', 'gp-premium' ), 'section' => $header_section, 'choices' => array( 'logo' => esc_html__( 'Logo', 'gp-premium' ), 'title' => esc_html__( 'Site Title', 'gp-premium' ) ), 'settings' => 'generate_menu_plus_settings[mobile_header_branding]', 'active_callback' => 'generate_mobile_header_activated', ) ); // Mobile header logo $wp_customize->add_setting( 'generate_menu_plus_settings[mobile_header_logo]', array( 'default' => $defaults['mobile_header_logo'], 'type' => 'option', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'generate_menu_plus_settings[mobile_header_logo]', array( 'label' => esc_html__( 'Logo', 'gp-premium' ), 'section' => $header_section, 'settings' => 'generate_menu_plus_settings[mobile_header_logo]', 'active_callback' => 'generate_mobile_header_logo_active_callback' ) ) ); // Sticky mobile header $wp_customize->add_setting( 'generate_menu_plus_settings[mobile_header_sticky]', array( 'default' => $defaults['mobile_header_sticky'], 'type' => 'option', 'sanitize_callback' => 'generate_premium_sanitize_choices' ) ); $wp_customize->add_control( 'generate_menu_plus_settings[mobile_header_sticky]', array( 'type' => 'select', 'label' => esc_html__( 'Sticky', 'gp-premium' ), 'section' => $header_section, 'choices' => array( 'enable' => esc_html__( 'On', 'gp-premium' ), 'disable' => esc_html__( 'Off', 'gp-premium' ) ), 'settings' => 'generate_menu_plus_settings[mobile_header_sticky]', 'active_callback' => 'generate_mobile_header_activated' ) ); // Auto hide on scroll down $wp_customize->add_setting( 'generate_menu_plus_settings[mobile_header_auto_hide_sticky]', array( 'default' => $defaults['mobile_header_auto_hide_sticky'], 'type' => 'option', 'sanitize_callback' => 'generate_premium_sanitize_checkbox' ) ); $wp_customize->add_control( 'generate_menu_plus_settings[mobile_header_auto_hide_sticky]', array( 'type' => 'checkbox', 'label' => esc_html__( 'Hide when scrolling down', 'gp-premium' ), 'section' => $header_section, 'settings' => 'generate_menu_plus_settings[mobile_header_auto_hide_sticky]', 'active_callback' => 'generate_mobile_header_sticky_activated' ) ); // Slide-out menu section $wp_customize->add_section( 'menu_plus_slideout_menu', array( 'title' => esc_html__( 'Off Canvas Panel', 'gp-premium' ), 'capability' => 'edit_theme_options', 'panel' => $panel, 'priority' => 34 ) ); $wp_customize->add_control( new GeneratePress_Section_Shortcut_Control( $wp_customize, 'generate_off_canvas_layout_shortcuts', array( 'section' => 'menu_plus_slideout_menu', 'element' => __( 'Off Canvas Panel', 'gp-premium' ), 'shortcuts' => array( 'colors' => 'slideout_color_section', 'typography' => 'generate_slideout_typography', ), 'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname', 'priority' => 1, ) ) ); // Slide-out menu $wp_customize->add_setting( 'generate_menu_plus_settings[slideout_menu]', array( 'default' => $defaults['slideout_menu'], 'type' => 'option', 'sanitize_callback' => 'generate_premium_sanitize_choices' ) ); $wp_customize->add_control( 'generate_menu_plus_settings[slideout_menu]', array( 'type' => 'select', 'label' => esc_html__( 'Off Canvas Panel', 'gp-premium' ), 'section' => 'menu_plus_slideout_menu', 'choices' => array( 'mobile' => esc_html__( 'Mobile only', 'gp-premium' ), 'desktop' => esc_html__( 'Desktop only', 'gp-premium' ), 'both' => esc_html__( 'On', 'gp-premium' ), 'false' => esc_html__( 'Off', 'gp-premium' ) ), 'settings' => 'generate_menu_plus_settings[slideout_menu]', ) ); $wp_customize->add_setting( 'generate_menu_plus_settings[off_canvas_desktop_toggle_label]', array( 'default' => $defaults['off_canvas_desktop_toggle_label'], 'type' => 'option', 'sanitize_callback' => 'wp_kses_post' ) ); $wp_customize->add_control( 'generate_menu_plus_settings[off_canvas_desktop_toggle_label]', array( 'label' => esc_html__( 'Desktop Toggle Label', 'gp-premium' ), 'section' => 'menu_plus_slideout_menu', 'settings' => 'generate_menu_plus_settings[off_canvas_desktop_toggle_label]', 'active_callback' => 'generate_slideout_navigation_activated', ) ); $wp_customize->add_setting( 'generate_menu_plus_settings[slideout_menu_style]', array( 'default' => $defaults['slideout_menu_style'], 'type' => 'option', 'sanitize_callback' => 'generate_premium_sanitize_choices' ) ); $wp_customize->add_control( 'generate_menu_plus_settings[slideout_menu_style]', array( 'type' => 'select', 'label' => esc_html__( 'Style', 'gp-premium' ), 'section' => 'menu_plus_slideout_menu', 'choices' => array( 'slide' => esc_html__( 'Slide', 'gp-premium' ), 'overlay' => esc_html__( 'Overlay', 'gp-premium' ), ), 'settings' => 'generate_menu_plus_settings[slideout_menu_style]', 'active_callback' => 'generate_slideout_navigation_activated', ) ); $wp_customize->add_setting( 'generate_menu_plus_settings[slideout_menu_side]', array( 'default' => $defaults['slideout_menu_side'], 'type' => 'option', 'sanitize_callback' => 'generate_premium_sanitize_choices' ) ); $wp_customize->add_control( 'generate_menu_plus_settings[slideout_menu_side]', array( 'type' => 'select', 'label' => esc_html__( 'Side', 'gp-premium' ), 'section' => 'menu_plus_slideout_menu', 'choices' => array( 'left' => esc_html__( 'Left', 'gp-premium' ), 'right' => esc_html__( 'Right', 'gp-premium' ), ), 'settings' => 'generate_menu_plus_settings[slideout_menu_side]', 'active_callback' => 'generate_is_slideout_navigation_active_callback', ) ); $wp_customize->add_control( new GeneratePress_Action_Button_Control( $wp_customize, 'generate_set_slideout_overlay_option', array( 'section' => 'menu_plus_slideout_menu', 'data_type' => 'overlay_design', 'label' => __( 'Set Overlay Defaults', 'gp-premium' ), 'description' => esc_html__( 'Clicking the above button will design your overlay by changing some of your off canvas color and typography options.', 'gp-premium' ), 'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname', 'active_callback' => 'generate_is_overlay_navigation_active_callback', ) ) ); $wp_customize->add_setting( 'generate_menu_plus_settings[slideout_close_button]', array( 'default' => $defaults['slideout_close_button'], 'type' => 'option', 'sanitize_callback' => 'generate_premium_sanitize_choices' ) ); $wp_customize->add_control( 'generate_menu_plus_settings[slideout_close_button]', array( 'type' => 'select', 'label' => esc_html__( 'Close Button', 'gp-premium' ), 'section' => 'menu_plus_slideout_menu', 'choices' => array( 'outside' => esc_html__( 'Outside', 'gp-premium' ), 'inside' => esc_html__( 'Inside', 'gp-premium' ), ), 'settings' => 'generate_menu_plus_settings[slideout_close_button]', 'active_callback' => 'generate_is_slideout_navigation_active_callback', ) ); } } if ( ! function_exists( 'generate_menu_plus_enqueue_css' ) ) { add_action( 'wp_enqueue_scripts', 'generate_menu_plus_enqueue_css', 100 ); /** * Enqueue scripts */ function generate_menu_plus_enqueue_css() { $settings = wp_parse_args( get_option( 'generate_menu_plus_settings', array() ), generate_menu_plus_get_defaults() ); $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; // Add sticky menu script if ( 'false' !== $settings['sticky_menu'] ) { wp_enqueue_style( 'generate-sticky', plugin_dir_url( __FILE__ ) . "css/sticky{$suffix}.css", array(), GENERATE_MENU_PLUS_VERSION ); } // Add slideout menu script if ( 'false' !== $settings['slideout_menu'] ) { wp_enqueue_style( 'generate-offside', plugin_dir_url( __FILE__ ) . "css/offside{$suffix}.css", array(), GENERATE_MENU_PLUS_VERSION ); wp_add_inline_style( 'generate-offside', generate_do_off_canvas_css() ); $font_icons = true; if ( function_exists( 'generate_get_option' ) ) { if ( 'font' !== generate_get_option( 'icons' ) ) { $font_icons = false; } } if ( $font_icons ) { wp_enqueue_style( 'gp-premium-icons' ); } } // Add regular menu logo styling if ( '' !== $settings['sticky_menu_logo'] ) { wp_enqueue_style( 'generate-menu-logo', plugin_dir_url( __FILE__ ) . "css/menu-logo{$suffix}.css", array(), GENERATE_MENU_PLUS_VERSION ); wp_add_inline_style( 'generate-menu-logo', generate_do_mobile_navigation_logo_css() ); } if ( $settings['navigation_as_header'] || $settings['sticky_navigation_logo'] || 'enable' == $settings['mobile_header'] ) { wp_enqueue_style( 'generate-navigation-branding', plugin_dir_url( __FILE__ ) . "css/navigation-branding{$suffix}.css", array(), GENERATE_MENU_PLUS_VERSION ); wp_add_inline_style( 'generate-navigation-branding', generate_do_nav_branding_css() ); } // Add inline CSS wp_add_inline_style( 'generate-style', generate_menu_plus_inline_css() ); } } if ( ! function_exists( 'generate_menu_plus_enqueue_js' ) ) { add_action( 'wp_enqueue_scripts', 'generate_menu_plus_enqueue_js', 0 ); /** * Enqueue scripts */ function generate_menu_plus_enqueue_js() { $settings = wp_parse_args( get_option( 'generate_menu_plus_settings', array() ), generate_menu_plus_get_defaults() ); $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; // Add sticky menu script if ( ( 'false' !== $settings['sticky_menu'] ) || ( 'enable' == $settings['mobile_header'] && 'enable' == $settings['mobile_header_sticky'] ) ) { wp_enqueue_script( 'generate-sticky', plugin_dir_url( __FILE__ ) . "js/sticky{$suffix}.js", array( 'jquery' ), GENERATE_MENU_PLUS_VERSION, true ); } // Add slideout menu script if ( 'false' !== $settings['slideout_menu'] ) { wp_enqueue_script( 'generate-offside', plugin_dir_url( __FILE__ ) . "js/offside{$suffix}.js", array(), GENERATE_MENU_PLUS_VERSION, true ); wp_localize_script( 'generate-offside', 'offSide', array( 'side' => $settings['slideout_menu_side'] ) ); } } } if ( ! function_exists( 'generate_menu_plus_mobile_header_js' ) ) { add_action( 'wp_enqueue_scripts', 'generate_menu_plus_mobile_header_js', 15 ); /** * Enqueue scripts */ function generate_menu_plus_mobile_header_js() { if ( function_exists( 'wp_add_inline_script' ) ) { $settings = wp_parse_args( get_option( 'generate_menu_plus_settings', array() ), generate_menu_plus_get_defaults() ); if ( 'enable' == $settings[ 'mobile_header' ] && ( 'desktop' == $settings[ 'slideout_menu' ] || 'false' == $settings[ 'slideout_menu' ] ) ) { wp_add_inline_script( 'generate-navigation', "jQuery( document ).ready( function($) { $( '#mobile-header .menu-toggle' ).on( 'click', function( e ) { e.preventDefault(); $( this ).closest( '#mobile-header' ).toggleClass( 'toggled' ); $( this ).closest( '#mobile-header' ).attr( 'aria-expanded', $( this ).closest( '#mobile-header' ).attr( 'aria-expanded' ) === 'true' ? 'false' : 'true' ); $( this ).toggleClass( 'toggled' ); $( this ).children( 'i' ).toggleClass( 'fa-bars' ).toggleClass( 'fa-close' ); $( this ).attr( 'aria-expanded', $( this ).attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); }); });" ); } } } } if ( ! function_exists( 'generate_menu_plus_inline_css' ) ) { /** * Enqueue inline CSS */ function generate_menu_plus_inline_css() { // Bail if GP isn't active if ( ! function_exists( 'generate_get_defaults' ) ) { return; } $generate_settings = wp_parse_args( get_option( 'generate_settings', array() ), generate_get_defaults() ); $generate_menu_plus_settings = wp_parse_args( get_option( 'generate_menu_plus_settings', array() ), generate_menu_plus_get_defaults() ); if ( function_exists( 'generate_spacing_get_defaults' ) ) { $spacing_settings = wp_parse_args( get_option( 'generate_spacing_settings', array() ), generate_spacing_get_defaults() ); $menu_height = $spacing_settings['menu_item_height']; } else { $menu_height = 60; } $return = ''; if ( '' !== $generate_menu_plus_settings['sticky_menu_logo'] ) { $return .= '.main-navigation .navigation-logo img {height:' . absint( $menu_height ) . 'px;}'; $return .= '@media (max-width: ' . ( absint( $generate_settings['container_width'] + 10 ) ) . 'px) {.main-navigation .navigation-logo.site-logo {margin-left:0;}body.sticky-menu-logo.nav-float-left .main-navigation .site-logo.navigation-logo {margin-right:0;}}'; } if ( 'false' !== $generate_menu_plus_settings['sticky_menu'] ) { $return .= '.main-navigation .main-nav ul li a,.menu-toggle,.main-navigation .mobile-bar-items a{transition: line-height 300ms ease}'; if ( class_exists( 'FLBuilderModel' ) ) { $return .= '.fl-builder-edit .navigation-stick {z-index: 10 !important;}'; } } if ( function_exists( 'generate_get_color_defaults' ) ) { $color_defaults = wp_parse_args( get_option( 'generate_settings', array() ), generate_get_color_defaults() ); if ( 'true' === $generate_menu_plus_settings['sticky_menu'] || 'mobile' === $generate_menu_plus_settings['sticky_menu'] || 'enable' === $generate_menu_plus_settings['mobile_header_sticky'] ) { $return .= '.main-navigation.toggled .main-nav > ul{background-color: ' . $color_defaults['navigation_background_color'] . '}'; } } return $return; } } if ( ! function_exists( 'generate_menu_plus_mobile_header' ) ) { add_action( 'generate_after_header', 'generate_menu_plus_mobile_header', 5 ); add_action( 'generate_inside_mobile_header', 'generate_navigation_search', 1 ); add_action( 'generate_inside_mobile_header', 'generate_mobile_menu_search_icon' ); function generate_menu_plus_mobile_header() { $settings = wp_parse_args( get_option( 'generate_menu_plus_settings', array() ), generate_menu_plus_get_defaults() ); if ( 'disable' == $settings[ 'mobile_header' ] ) { return; } if ( 'false' !== $settings['mobile_header_auto_hide_sticky'] && $settings[ 'mobile_header_auto_hide_sticky' ] ) { $hide_sticky = ' data-auto-hide-sticky="true"'; } else { $hide_sticky = ''; } $microdata = 'itemtype="https://schema.org/SiteNavigationElement" itemscope'; if ( function_exists( 'generate_get_microdata' ) ) { $microdata = generate_get_microdata( 'navigation' ); } $classes = array( 'main-navigation', 'mobile-header-navigation', ); if ( ( 'logo' === $settings['mobile_header_branding'] && '' !== $settings['mobile_header_logo'] ) || 'title' === $settings['mobile_header_branding'] ) { $classes[] = 'has-branding'; } if ( 'enable' === $settings['mobile_header_sticky'] ) { if ( ( 'logo' === $settings['mobile_header_branding'] && '' !== $settings['mobile_header_logo'] ) || 'title' === $settings['mobile_header_branding'] ) { $classes[] = 'has-sticky-branding'; } } $classes = implode( ' ', $classes ); ?>
esc_html__( 'Off Canvas Panel', 'gp-premium' ), 'id' => 'slide-out-widget', 'before_widget' => '', 'before_title' => apply_filters( 'generate_start_widget_title', '