芝麻web文件管理V1.00
编辑当前文件:/home/conskgoa/doughi.co.uk/generatepress.zip
PK C\)G{ G{ inc/plugin-compat.phpnu [
>
> < >
>
>
post_date ); if ( $post_date < $compare_date ) { $css = '.fl-builder.no-sidebar .container.grid-container { max-width: 100%; } .fl-builder.one-container.no-sidebar .site-content { padding:0; }'; $css = str_replace( array( "\r", "\n", "\t" ), '', $css ); wp_add_inline_style( 'generate-style', $css ); } } } } add_action( 'wp_enqueue_scripts', 'generate_do_third_party_plugin_css', 50 ); /** * Add CSS for third-party plugins. * * @since 3.0.1 */ function generate_do_third_party_plugin_css() { $css = new GeneratePress_CSS(); if ( generate_is_using_flexbox() && class_exists( 'Elementor\Plugin' ) ) { $css->set_selector( '.elementor-template-full-width .site-content' ); $css->add_property( 'display', 'block' ); } if ( $css->css_output() ) { wp_add_inline_style( 'generate-style', $css->css_output() ); } } add_action( 'wp_enqueue_scripts', 'generate_do_pro_compatibility', 50 ); /** * Add CSS to ensure compatibility with GP Premium. * * @since 3.0.0 */ function generate_do_pro_compatibility() { if ( ! defined( 'GP_PREMIUM_VERSION' ) ) { return; } $css = new GeneratePress_CSS(); if ( version_compare( GP_PREMIUM_VERSION, '1.11.0-alpha.1', '<' ) ) { if ( generate_is_using_flexbox() && defined( 'GENERATE_SECONDARY_NAV_VERSION' ) ) { $css->set_selector( '.secondary-navigation .inside-navigation:before, .secondary-navigation .inside-navigation:after' ); $css->add_property( 'content', '"."' ); $css->add_property( 'display', 'block' ); $css->add_property( 'overflow', 'hidden' ); $css->add_property( 'visibility', 'hidden' ); $css->add_property( 'font-size', '0px' ); $css->add_property( 'line-height', '0px' ); $css->add_property( 'width', '0px' ); $css->add_property( 'height', '0px' ); $css->set_selector( '.secondary-navigation .inside-navigation:after' ); $css->add_property( 'clear', 'both' ); } } if ( version_compare( GP_PREMIUM_VERSION, '1.12.0-alpha.1', '<' ) ) { if ( defined( 'GENERATE_MENU_PLUS_VERSION' ) && function_exists( 'generate_menu_plus_get_defaults' ) ) { $menu_plus_settings = wp_parse_args( get_option( 'generate_menu_plus_settings', array() ), generate_menu_plus_get_defaults() ); if ( generate_is_using_flexbox() && ( 'true' === $menu_plus_settings['sticky_menu'] || 'desktop' === $menu_plus_settings['sticky_menu'] || 'mobile' === $menu_plus_settings['sticky_menu'] || 'enable' === $menu_plus_settings['mobile_header_sticky'] ) ) { if ( generate_has_inline_mobile_toggle() ) { $css->start_media_query( generate_get_media_query( 'mobile-menu' ) ); $css->set_selector( '#sticky-placeholder' ); $css->add_property( 'height', '0' ); $css->add_property( 'overflow', 'hidden' ); $css->set_selector( '.has-inline-mobile-toggle #site-navigation.toggled' ); $css->add_property( 'margin-top', '0' ); $css->set_selector( '.has-inline-mobile-menu #site-navigation.toggled .main-nav > ul' ); $css->add_property( 'top', '1.5em' ); $css->stop_media_query(); } if ( 'desktop' === $menu_plus_settings['sticky_menu'] ) { $css->set_selector( '.sticky-enabled .gen-sidebar-nav.is_stuck .main-navigation' ); $css->add_property( 'margin-bottom', '0' ); $css->set_selector( '.sticky-enabled .gen-sidebar-nav.is_stuck' ); $css->add_property( 'z-index', '500' ); $css->set_selector( '.sticky-enabled .main-navigation.is_stuck' ); $css->add_property( 'box-shadow', '0 2px 2px -2px rgba(0, 0, 0, .2)' ); $css->set_selector( '.navigation-stick:not(.gen-sidebar-nav)' ); $css->add_property( 'left', '0' ); $css->add_property( 'right', '0' ); $css->add_property( 'width', '100% !important' ); $css->set_selector( '.both-sticky-menu .main-navigation:not(#mobile-header).toggled .main-nav > ul,.mobile-sticky-menu .main-navigation:not(#mobile-header).toggled .main-nav > ul,.mobile-header-sticky #mobile-header.toggled .main-nav > ul' ); $css->add_property( 'position', 'absolute' ); $css->add_property( 'left', '0' ); $css->add_property( 'right', '0' ); $css->add_property( 'z-index', '999' ); } $css->set_selector( '.nav-float-right .navigation-stick' ); $css->add_property( 'width', '100% !important' ); $css->add_property( 'left', '0' ); $css->set_selector( '.nav-float-right .navigation-stick .navigation-branding' ); $css->add_property( 'margin-right', 'auto' ); if ( ! $menu_plus_settings['navigation_as_header'] ) { $header_left = 40; $header_right = 40; $mobile_header_left = 30; $mobile_header_right = 30; if ( function_exists( 'generate_spacing_get_defaults' ) ) { $spacing_settings = wp_parse_args( get_option( 'generate_spacing_settings', array() ), generate_spacing_get_defaults() ); $header_left = $spacing_settings['header_left']; $header_right = $spacing_settings['header_right']; $mobile_header_left = $spacing_settings['mobile_header_left']; $mobile_header_right = $spacing_settings['mobile_header_right']; } if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) { if ( function_exists( 'generate_get_option' ) && 'text' === generate_get_option( 'container_alignment' ) ) { $css->set_selector( '.main-navigation.navigation-stick .inside-navigation.grid-container' ); $css->add_property( 'padding-left', $header_left, false, 'px' ); $css->add_property( 'padding-right', $header_right, false, 'px' ); $css->start_media_query( generate_get_media_query( 'mobile-menu' ) ); $css->set_selector( '.main-navigation.navigation-stick .inside-navigation.grid-container' ); $css->add_property( 'padding-left', $mobile_header_left, false, 'px' ); $css->add_property( 'padding-right', $mobile_header_right, false, 'px' ); $css->stop_media_query(); } } } $css->set_selector( '.nav-float-right .main-navigation.has-branding:not([class*="nav-align-"]):not(.mobile-header-navigation) .menu-bar-items,.nav-float-right .main-navigation.has-sticky-branding.navigation-stick:not([class*="nav-align-"]):not(.mobile-header-navigation) .menu-bar-items' ); $css->add_property( 'margin-left', '0' ); } if ( generate_has_inline_mobile_toggle() && 'false' !== $menu_plus_settings['slideout_menu'] ) { $css->set_selector( '.slideout-mobile .has-inline-mobile-toggle #site-navigation.toggled,.slideout-both .has-inline-mobile-toggle #site-navigation.toggled' ); $css->add_property( 'margin-top', '0' ); } if ( 'font' === generate_get_option( 'icons' ) ) { $css->set_selector( '.main-navigation .slideout-toggle a:before,.slide-opened .slideout-overlay .slideout-exit:before' ); $css->add_property( 'font-family', 'GeneratePress' ); $css->set_selector( '.slideout-navigation .dropdown-menu-toggle:before' ); $css->add_property( 'content', '"\f107" !important' ); $css->set_selector( '.slideout-navigation .sfHover > a .dropdown-menu-toggle:before' ); $css->add_property( 'content', '"\f106" !important' ); } if ( generate_is_using_flexbox() && $menu_plus_settings['navigation_as_header'] ) { $content_left = 40; $content_right = 40; if ( function_exists( 'generate_spacing_get_defaults' ) ) { $spacing_settings = wp_parse_args( get_option( 'generate_spacing_settings', array() ), generate_spacing_get_defaults() ); $content_left = $spacing_settings['content_left']; $content_right = $spacing_settings['content_right']; } if ( 'text' === generate_get_option( 'container_alignment' ) ) { $css->set_selector( '.main-navigation.has-branding .inside-navigation.grid-container, .main-navigation.has-branding .inside-navigation.grid-container' ); $css->add_property( 'padding', generate_padding_css( 0, $content_right, 0, $content_left ) ); } $css->set_selector( '.navigation-branding' ); $css->add_property( 'margin-left', '10px' ); $css->set_selector( '.navigation-branding .main-title, .mobile-header-navigation .site-logo' ); $css->add_property( 'margin-left', '10px' ); if ( is_rtl() ) { $css->set_selector( '.navigation-branding' ); $css->add_property( 'margin-left', 'auto' ); $css->add_property( 'margin-right', '10px' ); $css->set_selector( '.navigation-branding .main-title, .mobile-header-navigation .site-logo' ); $css->add_property( 'margin-right', '10px' ); $css->add_property( 'margin-left', '0' ); } $css->set_selector( '.navigation-branding > div + .main-title' ); $css->add_property( 'margin-left', '10px' ); if ( is_rtl() ) { $css->set_selector( '.navigation-branding > div + .main-title' ); $css->add_property( 'margin-right', '10px' ); } $css->set_selector( '.has-branding .navigation-branding img' ); $css->add_property( 'margin', '0' ); $css->start_media_query( generate_get_media_query( 'mobile-menu' ) ); if ( 'text' === generate_get_option( 'container_alignment' ) ) { $css->set_selector( '.main-navigation.has-branding .inside-navigation.grid-container' ); $css->add_property( 'padding', '0' ); } $css->stop_media_query(); } } if ( defined( 'GENERATE_SPACING_VERSION' ) ) { if ( generate_is_using_flexbox() ) { $css->set_selector( '#footer-widgets, .site-info' ); $css->add_property( 'padding', '0' ); } } if ( defined( 'GENERATE_SECONDARY_NAV_VERSION' ) ) { if ( generate_is_using_flexbox() && has_nav_menu( 'secondary' ) ) { if ( 'text' === generate_get_option( 'container_alignment' ) && function_exists( 'generate_secondary_nav_get_defaults' ) ) { $secondary_nav_settings = wp_parse_args( get_option( 'generate_secondary_nav_settings', array() ), generate_secondary_nav_get_defaults() ); $spacing_settings = wp_parse_args( get_option( 'generate_spacing_settings', array() ), generate_spacing_get_defaults() ); $navigation_left_padding = absint( $spacing_settings['header_left'] ) - absint( $secondary_nav_settings['secondary_menu_item'] ); $navigation_right_padding = absint( $spacing_settings['header_right'] ) - absint( $secondary_nav_settings['secondary_menu_item'] ); $css->set_selector( '.secondary-nav-below-header .secondary-navigation .inside-navigation.grid-container, .secondary-nav-above-header .secondary-navigation .inside-navigation.grid-container' ); $css->add_property( 'padding', generate_padding_css( 0, $navigation_right_padding, 0, $navigation_left_padding ) ); } } } if ( generate_is_using_flexbox() && defined( 'GENERATE_FONT_VERSION' ) && function_exists( 'generate_get_default_fonts' ) ) { $font_settings = wp_parse_args( get_option( 'generate_settings', array() ), generate_get_default_fonts() ); if ( isset( $font_settings['tablet_navigation_font_size'] ) && '' !== $font_settings['tablet_navigation_font_size'] ) { $css->start_media_query( generate_get_media_query( 'tablet' ) ); $css->set_selector( '.main-navigation .menu-toggle' ); $css->add_property( 'font-size', absint( $font_settings['tablet_navigation_font_size'] ), false, 'px' ); $css->stop_media_query(); } if ( isset( $font_settings['mobile_navigation_font_size'] ) && '' !== $font_settings['mobile_navigation_font_size'] ) { $css->start_media_query( generate_get_media_query( 'mobile-menu' ) ); $css->set_selector( '.main-navigation .menu-toggle' ); $css->add_property( 'font-size', absint( $font_settings['mobile_navigation_font_size'] ), false, 'px' ); $css->stop_media_query(); } } if ( ! generate_show_title() ) { $css->set_selector( '.page .entry-content' )->add_property( 'margin-top', '0px' ); if ( is_single() ) { if ( ! apply_filters( 'generate_post_author', true ) && ! apply_filters( 'generate_post_date', true ) ) { $css->set_selector( '.single .entry-content' )->add_property( 'margin-top', '0' ); } } } } if ( $css->css_output() ) { wp_add_inline_style( 'generate-style', $css->css_output() ); } } add_filter( 'generate_menu_item_dropdown_arrow_direction', 'generate_set_pro_menu_item_arrow_directions', 10, 3 ); /** * Set the menu item arrow directions for Secondary and Slideout navs. * * @since 3.0.0 * @param string $arrow_direction The current direction. * @param object $args The args for the current menu. * @param int $depth The current depth of the menu item. */ function generate_set_pro_menu_item_arrow_directions( $arrow_direction, $args, $depth ) { if ( function_exists( 'generate_secondary_nav_get_defaults' ) && 'secondary' === $args->theme_location ) { $settings = wp_parse_args( get_option( 'generate_secondary_nav_settings', array() ), generate_secondary_nav_get_defaults() ); if ( 0 !== $depth ) { $arrow_direction = 'right'; if ( 'left' === $settings['secondary_nav_dropdown_direction'] ) { $arrow_direction = 'left'; } } if ( 'secondary-nav-left-sidebar' === $settings['secondary_nav_position_setting'] ) { $arrow_direction = 'right'; if ( 'both-right' === generate_get_layout() ) { $arrow_direction = 'left'; } } if ( 'secondary-nav-right-sidebar' === $settings['secondary_nav_position_setting'] ) { $arrow_direction = 'left'; if ( 'both-left' === generate_get_layout() ) { $arrow_direction = 'right'; } } if ( 'hover' !== generate_get_option( 'nav_dropdown_type' ) ) { $arrow_direction = 'down'; } } return $arrow_direction; } add_filter( 'generate_menu_plus_option_defaults', 'generate_set_menu_plus_compat_defaults' ); /** * Set defaults in our pro Menu Plus module. * * @since 3.0.0 * @param array $defaults The existing defaults. */ function generate_set_menu_plus_compat_defaults( $defaults ) { if ( generate_has_inline_mobile_toggle() ) { $defaults['mobile_menu_label'] = ''; } return $defaults; } add_filter( 'generate_spacing_option_defaults', 'generate_set_spacing_compat_defaults', 20 ); /** * Set defaults in our pro Spacing module. * * @since 3.0.0 * @param array $defaults The existing defaults. */ function generate_set_spacing_compat_defaults( $defaults ) { $defaults['mobile_header_top'] = ''; $defaults['mobile_header_bottom'] = ''; $defaults['mobile_header_right'] = '30'; $defaults['mobile_header_left'] = '30'; $defaults['mobile_widget_top'] = '30'; $defaults['mobile_widget_right'] = '30'; $defaults['mobile_widget_bottom'] = '30'; $defaults['mobile_widget_left'] = '30'; $defaults['mobile_footer_widget_container_top'] = '30'; $defaults['mobile_footer_widget_container_right'] = '30'; $defaults['mobile_footer_widget_container_bottom'] = '30'; $defaults['mobile_footer_widget_container_left'] = '30'; return $defaults; } add_filter( 'generate_page_hero_css_output', 'generate_do_pro_page_hero_css', 10, 2 ); /** * Add CSS to our premium Page Heroes. * * @since 3.0.0 * @param string $css_output Existing CSS. * @param array $options The Header Element options. */ function generate_do_pro_page_hero_css( $css_output, $options ) { if ( ! defined( 'GP_PREMIUM_VERSION' ) ) { return $css_output; } $new_css = ''; if ( version_compare( GP_PREMIUM_VERSION, '1.12.0-alpha.1', '<' ) ) { $css = new GeneratePress_CSS(); $padding_inside = false; if ( generate_is_using_flexbox() && 'text' === generate_get_option( 'container_alignment' ) ) { $padding_inside = true; } if ( $padding_inside ) { $container_width = generate_get_option( 'container_width' ); $padding_right = '0px'; $padding_left = '0px'; if ( $options['padding_right'] ) { $padding_right = absint( $options['padding_right'] ) . $options['padding_right_unit']; } if ( $options['padding_left'] ) { $padding_left = absint( $options['padding_left'] ) . $options['padding_left_unit']; } $css->set_selector( '.page-hero .inside-page-hero.grid-container' ); $css->add_property( 'max-width', sprintf( 'calc(%1$s - %2$s - %3$s)', $container_width . 'px', $padding_right, $padding_left ) ); } if ( generate_is_using_flexbox() && '' !== $options['site_header_merge'] ) { if ( 'merge-desktop' === $options['site_header_merge'] ) { $css->start_media_query( apply_filters( 'generate_not_mobile_media_query', '(min-width: 769px)' ) ); } if ( $options['navigation_colors'] ) { $navigation_background = $options['navigation_background_color'] ? $options['navigation_background_color'] : 'transparent'; $navigation_background_hover = $options['navigation_background_color_hover'] ? $options['navigation_background_color_hover'] : 'transparent'; $css->set_selector( '.header-wrap #site-navigation:not(.toggled), .header-wrap #mobile-header:not(.toggled):not(.navigation-stick), .has-inline-mobile-toggle .mobile-menu-control-wrapper' ); $css->add_property( 'background', $navigation_background ); $css->set_selector( '.main-navigation:not(.toggled):not(.navigation-stick) .menu-bar-item:not(.close-search) > a' ); $css->add_property( 'color', esc_attr( $options['navigation_text_color'] ) ); $css->set_selector( '.header-wrap #site-navigation:not(.toggled) .menu-bar-item:not(.close-search):hover > a, .header-wrap #mobile-header:not(.toggled) .menu-bar-item:not(.close-search):hover > a, .header-wrap #site-navigation:not(.toggled) .menu-bar-item:not(.close-search).sfHover > a, .header-wrap #mobile-header:not(.toggled) .menu-bar-item:not(.close-search).sfHover > a' ); $css->add_property( 'background', $navigation_background_hover ); if ( '' !== $options['navigation_text_color_hover'] ) { $css->add_property( 'color', esc_attr( $options['navigation_text_color_hover'] ) ); } else { $css->add_property( 'color', esc_attr( $options['navigation_text_color'] ) ); } } if ( 'merge-desktop' === $options['site_header_merge'] ) { $css->stop_media_query(); } } if ( $css->css_output() ) { $new_css = $css->css_output(); } } return $css_output . $new_css; } add_action( 'customize_register', 'generate_pro_compat_customize_register', 100 ); /** * Alter some Customizer options in the pro version. * * @since 3.0.0 * @param object $wp_customize The Customizer object. */ function generate_pro_compat_customize_register( $wp_customize ) { if ( ! defined( 'GP_PREMIUM_VERSION' ) ) { return; } if ( version_compare( GP_PREMIUM_VERSION, '1.12.0-alpha.1', '<' ) ) { if ( $wp_customize->get_setting( 'generate_spacing_settings[separator]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[separator]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[right_sidebar_width]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[right_sidebar_width]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[left_sidebar_width]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[left_sidebar_width]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_top]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_top]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_right]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_right]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_bottom]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_bottom]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_left]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[footer_widget_container_left]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_top]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_top]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_right]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_right]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_bottom]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_bottom]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_left]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[mobile_footer_widget_container_left]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_top]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[footer_top]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_right]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[footer_right]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_bottom]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[footer_bottom]' )->transport = 'refresh'; } if ( $wp_customize->get_setting( 'generate_spacing_settings[footer_left]' ) ) { $wp_customize->get_setting( 'generate_spacing_settings[footer_left]' )->transport = 'refresh'; } } if ( $wp_customize->get_panel( 'generate_typography_panel' ) ) { $wp_customize->get_panel( 'generate_typography_panel' )->active_callback = function() { if ( generate_is_using_dynamic_typography() ) { return false; } return true; }; } } add_action( 'wp', 'generate_do_pro_compatibility_setup' ); /** * Do basic compatibility with GP Premium versions. * * @since 3.0.0 */ function generate_do_pro_compatibility_setup() { if ( ! defined( 'GP_PREMIUM_VERSION' ) ) { return; } if ( version_compare( GP_PREMIUM_VERSION, '1.12.0-alpha.1', '<' ) ) { // Fix Elements removing archive post titles. if ( function_exists( 'generate_premium_do_elements' ) && ! is_singular() ) { add_filter( 'generate_show_title', '__return_true', 20 ); } } if ( generate_is_using_dynamic_typography() ) { remove_action( 'wp_enqueue_scripts', 'generate_enqueue_google_fonts', 0 ); remove_action( 'wp_enqueue_scripts', 'generate_typography_premium_css', 100 ); remove_filter( 'generate_external_dynamic_css_output', 'generate_typography_add_to_external_stylesheet' ); } } add_filter( 'generate_has_active_menu', 'generate_do_pro_active_menus' ); /** * Tell GP about our active pro menus. * * @since 3.1.0 * @param boolean $has_active_menu Whether we have an active menu. */ function generate_do_pro_active_menus( $has_active_menu ) { if ( ! defined( 'GP_PREMIUM_VERSION' ) ) { return $has_active_menu; } if ( version_compare( GP_PREMIUM_VERSION, '2.1.0-alpha.1', '<' ) ) { if ( function_exists( 'generate_menu_plus_get_defaults' ) ) { $menu_plus_settings = wp_parse_args( get_option( 'generate_menu_plus_settings', array() ), generate_menu_plus_get_defaults() ); if ( 'disable' !== $menu_plus_settings['mobile_header'] || 'false' !== $menu_plus_settings['slideout_menu'] ) { $has_active_menu = true; } } if ( function_exists( 'generate_secondary_nav_get_defaults' ) && has_nav_menu( 'secondary' ) ) { $has_active_menu = true; } } return $has_active_menu; } add_action( 'init', 'generate_do_customizer_compatibility_setup' ); /** * Make changes to the Customizer in the Pro version. */ function generate_do_customizer_compatibility_setup() { if ( ! defined( 'GP_PREMIUM_VERSION' ) ) { return; } if ( version_compare( GP_PREMIUM_VERSION, '2.1.0-alpha.1', '<' ) ) { if ( generate_is_using_dynamic_typography() ) { remove_action( 'customize_register', 'generate_fonts_customize_register' ); remove_action( 'customize_preview_init', 'generate_typography_customizer_live_preview' ); } remove_action( 'customize_register', 'generate_colors_customize_register' ); remove_action( 'customize_preview_init', 'generate_colors_customizer_live_preview' ); remove_action( 'customize_controls_enqueue_scripts', 'generate_enqueue_color_palettes', 1001 ); remove_action( 'customize_register', 'generate_colors_secondary_nav_customizer', 1000 ); remove_action( 'customize_register', 'generate_slideout_navigation_color_controls', 150 ); remove_action( 'customize_register', 'generate_colors_wc_customizer', 100 ); } } PK C\ Φ inc/class-css.phpnu [ _selector ) { $this->add_selector_rules_to_output(); } $this->_selector = $selector; return $this; } /** * Adds a css property with value to the css output * * @access public * @since 1.0 * * @param string $property The css property. * @param string $value The value to be placed with the property. * @param string $og_default Check to see if the value matches the default. * @param string $unit The unit for the value (px). * @return $this */ public function add_property( $property, $value, $og_default = false, $unit = false ) { // Setting font-size to 0 is rarely ever a good thing. if ( 'font-size' === $property && 0 === $value ) { return false; } // Add our unit to our value if it exists. if ( $unit && '' !== $unit && is_numeric( $value ) ) { $value = $value . $unit; if ( '' !== $og_default ) { $og_default = $og_default . $unit; } } // If we don't have a value or our value is the same as our og default, bail. if ( ( empty( $value ) && ! is_numeric( $value ) ) || $og_default === $value ) { return false; } $this->_css .= $property . ':' . $value . ';'; return $this; } /** * Sets a media query in the class * * @since 1.1 * @param string $value The media query. * @return $this */ public function start_media_query( $value ) { // Add the current rules to the output. $this->add_selector_rules_to_output(); // Add any previous media queries to the output. if ( ! empty( $this->_media_query ) ) { $this->add_media_query_rules_to_output(); } // Set the new media query. $this->_media_query = $value; return $this; } /** * Stops using a media query. * * @see start_media_query() * * @since 1.1 * @return $this */ public function stop_media_query() { return $this->start_media_query( null ); } /** * Adds the current media query's rules to the class' output variable * * @since 1.1 * @return $this */ private function add_media_query_rules_to_output() { if ( ! empty( $this->_media_query_output ) ) { $this->_output .= sprintf( '@media %1$s{%2$s}', $this->_media_query, $this->_media_query_output ); // Reset the media query output string. $this->_media_query_output = ''; } return $this; } /** * Adds the current selector rules to the output variable * * @access private * @since 1.0 * * @return $this */ private function add_selector_rules_to_output() { if ( ! empty( $this->_css ) ) { $this->_selector_output = $this->_selector; $selector_output = sprintf( '%1$s{%2$s}', $this->_selector_output, $this->_css ); // Add our CSS to the output. if ( ! empty( $this->_media_query ) ) { $this->_media_query_output .= $selector_output; $this->_css = ''; } else { $this->_output .= $selector_output; } // Reset the css. $this->_css = ''; } return $this; } /** * Returns the minified css in the $_output variable * * @access public * @since 1.0 * * @return string */ public function css_output() { // Add current selector's rules to output. $this->add_selector_rules_to_output(); // Output minified css. return $this->_output; } } } PK C\4kX4 X4 inc/defaults.phpnu [ '', 'hide_tagline' => true, 'logo' => '', 'inline_logo_site_branding' => false, 'retina_logo' => '', 'logo_width' => '', 'top_bar_width' => 'full', 'top_bar_inner_width' => 'contained', 'top_bar_alignment' => 'right', 'container_width' => '1200', 'container_alignment' => 'text', 'header_layout_setting' => 'fluid-header', 'header_inner_width' => 'contained', 'nav_alignment_setting' => is_rtl() ? 'right' : 'left', 'header_alignment_setting' => is_rtl() ? 'right' : 'left', 'nav_layout_setting' => 'fluid-nav', 'nav_inner_width' => 'contained', 'nav_position_setting' => 'nav-float-right', 'nav_drop_point' => '', 'nav_dropdown_type' => 'hover', 'nav_dropdown_direction' => is_rtl() ? 'left' : 'right', 'nav_search' => 'disable', 'nav_search_modal' => false, 'content_layout_setting' => 'separate-containers', 'layout_setting' => 'right-sidebar', 'blog_layout_setting' => 'right-sidebar', 'single_layout_setting' => 'right-sidebar', 'post_content' => 'excerpt', 'footer_layout_setting' => 'fluid-footer', 'footer_inner_width' => 'contained', 'footer_widget_setting' => '3', 'footer_bar_alignment' => 'right', 'back_to_top' => '', 'background_color' => 'var(--base-2)', 'text_color' => 'var(--contrast)', 'link_color' => 'var(--accent)', 'link_color_hover' => 'var(--contrast)', 'link_color_visited' => '', 'font_awesome_essentials' => true, 'icons' => 'svg', 'combine_css' => true, 'dynamic_css_cache' => true, 'structure' => 'flexbox', 'underline_links' => 'always', 'font_manager' => array(), 'typography' => array(), 'google_font_display' => 'auto', 'use_dynamic_typography' => true, 'global_colors' => array( array( 'name' => __( 'Contrast', 'generatepress' ), 'slug' => 'contrast', 'color' => '#222222', ), array( /* translators: Contrast number */ 'name' => sprintf( __( 'Contrast %s', 'generatepress' ), '2' ), 'slug' => 'contrast-2', 'color' => '#575760', ), array( /* translators: Contrast number */ 'name' => sprintf( __( 'Contrast %s', 'generatepress' ), '3' ), 'slug' => 'contrast-3', 'color' => '#b2b2be', ), array( 'name' => __( 'Base', 'generatepress' ), 'slug' => 'base', 'color' => '#f0f0f0', ), array( /* translators: Base number */ 'name' => sprintf( __( 'Base %s', 'generatepress' ), '2' ), 'slug' => 'base-2', 'color' => '#f7f8f9', ), array( /* translators: Base number */ 'name' => sprintf( __( 'Base %s', 'generatepress' ), '3' ), 'slug' => 'base-3', 'color' => '#ffffff', ), array( 'name' => __( 'Accent', 'generatepress' ), 'slug' => 'accent', 'color' => '#1e73be', ), ), ) ); } } if ( ! function_exists( 'generate_get_color_defaults' ) ) { /** * Set default options */ function generate_get_color_defaults() { return apply_filters( 'generate_color_option_defaults', array( 'top_bar_background_color' => '#636363', 'top_bar_text_color' => '#ffffff', 'top_bar_link_color' => '#ffffff', 'top_bar_link_color_hover' => '#303030', 'header_background_color' => 'var(--base-3)', 'header_text_color' => '', 'header_link_color' => '', 'header_link_hover_color' => '', 'site_title_color' => 'var(--contrast)', 'site_tagline_color' => 'var(--contrast-2)', 'navigation_background_color' => 'var(--base-3)', 'navigation_text_color' => 'var(--contrast)', 'navigation_background_hover_color' => '', 'navigation_text_hover_color' => 'var(--accent)', 'navigation_background_current_color' => '', 'navigation_text_current_color' => 'var(--accent)', 'subnavigation_background_color' => 'var(--base)', 'subnavigation_text_color' => '', 'subnavigation_background_hover_color' => '', 'subnavigation_text_hover_color' => '', 'subnavigation_background_current_color' => '', 'subnavigation_text_current_color' => '', 'navigation_search_background_color' => '', 'navigation_search_text_color' => '', 'content_background_color' => 'var(--base-3)', 'content_text_color' => '', 'content_link_color' => '', 'content_link_hover_color' => '', 'content_title_color' => '', 'blog_post_title_color' => 'var(--contrast)', 'blog_post_title_hover_color' => 'var(--contrast-2)', 'entry_meta_text_color' => 'var(--contrast-2)', 'entry_meta_link_color' => '', 'entry_meta_link_color_hover' => '', 'h1_color' => '', 'h2_color' => '', 'h3_color' => '', 'h4_color' => '', 'h5_color' => '', 'h6_color' => '', 'sidebar_widget_background_color' => 'var(--base-3)', 'sidebar_widget_text_color' => '', 'sidebar_widget_link_color' => '', 'sidebar_widget_link_hover_color' => '', 'sidebar_widget_title_color' => '', 'footer_widget_background_color' => 'var(--base-3)', 'footer_widget_text_color' => '', 'footer_widget_link_color' => '', 'footer_widget_link_hover_color' => '', 'footer_widget_title_color' => '', 'footer_background_color' => 'var(--base-3)', 'footer_text_color' => '', 'footer_link_color' => '', 'footer_link_hover_color' => '', 'form_background_color' => 'var(--base-2)', 'form_text_color' => 'var(--contrast)', 'form_background_color_focus' => 'var(--base-2)', 'form_text_color_focus' => 'var(--contrast)', 'form_border_color' => 'var(--base)', 'form_border_color_focus' => 'var(--contrast-3)', 'form_button_background_color' => '#55555e', 'form_button_background_color_hover' => '#3f4047', 'form_button_text_color' => '#ffffff', 'form_button_text_color_hover' => '#ffffff', 'back_to_top_background_color' => 'rgba( 0,0,0,0.4 )', 'back_to_top_background_color_hover' => 'rgba( 0,0,0,0.6 )', 'back_to_top_text_color' => '#ffffff', 'back_to_top_text_color_hover' => '#ffffff', 'search_modal_bg_color' => 'var(--base-3)', 'search_modal_text_color' => 'var(--contrast)', 'search_modal_overlay_bg_color' => 'rgba(0,0,0,0.2)', ) ); } } if ( ! function_exists( 'generate_get_default_fonts' ) ) { /** * Set default options. * * @since 0.1 * * @param bool $filter Whether to return the filtered values or original values. * @return array Option defaults. */ function generate_get_default_fonts( $filter = true ) { $defaults = array( 'font_body' => 'System Stack', 'font_body_category' => '', 'font_body_variants' => '', 'body_font_weight' => 'normal', 'body_font_transform' => 'none', 'body_font_size' => '17', 'body_line_height' => '1.5', // no unit. 'paragraph_margin' => '1.5', // em. 'font_top_bar' => 'inherit', 'font_top_bar_category' => '', 'font_top_bar_variants' => '', 'top_bar_font_weight' => 'normal', 'top_bar_font_transform' => 'none', 'top_bar_font_size' => '13', 'font_site_title' => 'inherit', 'font_site_title_category' => '', 'font_site_title_variants' => '', 'site_title_font_weight' => 'bold', 'site_title_font_transform' => 'none', 'site_title_font_size' => '25', 'mobile_site_title_font_size' => '', 'font_site_tagline' => 'inherit', 'font_site_tagline_category' => '', 'font_site_tagline_variants' => '', 'site_tagline_font_weight' => 'normal', 'site_tagline_font_transform' => 'none', 'site_tagline_font_size' => '15', 'font_navigation' => 'inherit', 'font_navigation_category' => '', 'font_navigation_variants' => '', 'navigation_font_weight' => 'normal', 'navigation_font_transform' => 'none', 'navigation_font_size' => '15', 'font_widget_title' => 'inherit', 'font_widget_title_category' => '', 'font_widget_title_variants' => '', 'widget_title_font_weight' => 'normal', 'widget_title_font_transform' => 'none', 'widget_title_font_size' => '20', 'widget_title_separator' => '30', 'widget_content_font_size' => '17', 'font_buttons' => 'inherit', 'font_buttons_category' => '', 'font_buttons_variants' => '', 'buttons_font_weight' => 'normal', 'buttons_font_transform' => 'none', 'buttons_font_size' => '', 'font_heading_1' => 'inherit', 'font_heading_1_category' => '', 'font_heading_1_variants' => '', 'heading_1_weight' => 'normal', 'heading_1_transform' => 'none', 'heading_1_font_size' => '42', 'heading_1_line_height' => '1.2', // em. 'heading_1_margin_bottom' => '20', 'mobile_heading_1_font_size' => '31', 'font_heading_2' => 'inherit', 'font_heading_2_category' => '', 'font_heading_2_variants' => '', 'heading_2_weight' => 'normal', 'heading_2_transform' => 'none', 'heading_2_font_size' => '35', 'heading_2_line_height' => '1.2', // em. 'heading_2_margin_bottom' => '20', 'mobile_heading_2_font_size' => '27', 'font_heading_3' => 'inherit', 'font_heading_3_category' => '', 'font_heading_3_variants' => '', 'heading_3_weight' => 'normal', 'heading_3_transform' => 'none', 'heading_3_font_size' => '29', 'heading_3_line_height' => '1.2', // em. 'heading_3_margin_bottom' => '20', 'mobile_heading_3_font_size' => '24', 'font_heading_4' => 'inherit', 'font_heading_4_category' => '', 'font_heading_4_variants' => '', 'heading_4_weight' => 'normal', 'heading_4_transform' => 'none', 'heading_4_font_size' => '24', 'heading_4_line_height' => '', // em. 'mobile_heading_4_font_size' => '22', 'font_heading_5' => 'inherit', 'font_heading_5_category' => '', 'font_heading_5_variants' => '', 'heading_5_weight' => 'normal', 'heading_5_transform' => 'none', 'heading_5_font_size' => '20', 'heading_5_line_height' => '', // em. 'mobile_heading_5_font_size' => '19', 'font_heading_6' => 'inherit', 'font_heading_6_category' => '', 'font_heading_6_variants' => '', 'heading_6_weight' => 'normal', 'heading_6_transform' => 'none', 'heading_6_font_size' => '', 'heading_6_line_height' => '', // em. 'font_footer' => 'inherit', 'font_footer_category' => '', 'font_footer_variants' => '', 'footer_weight' => 'normal', 'footer_transform' => 'none', 'footer_font_size' => '15', ); if ( $filter ) { return apply_filters( 'generate_font_option_defaults', $defaults ); } return $defaults; } } if ( ! function_exists( 'generate_spacing_get_defaults' ) ) { /** * Set the default options. * * @since 0.1 * * @param bool $filter Whether to return the filtered values or original values. * @return array Option defaults. */ function generate_spacing_get_defaults( $filter = true ) { $defaults = array( 'top_bar_top' => '10', 'top_bar_right' => '40', 'top_bar_bottom' => '10', 'top_bar_left' => '40', 'mobile_top_bar_top' => '', 'mobile_top_bar_right' => '30', 'mobile_top_bar_bottom' => '', 'mobile_top_bar_left' => '30', 'header_top' => '20', 'header_right' => '40', 'header_bottom' => '20', 'header_left' => '40', 'menu_item' => '20', 'menu_item_height' => '60', 'sub_menu_item_height' => '10', 'sub_menu_width' => '200', 'content_top' => '40', 'content_right' => '40', 'content_bottom' => '40', 'content_left' => '40', 'mobile_content_top' => '30', 'mobile_content_right' => '30', 'mobile_content_bottom' => '30', 'mobile_content_left' => '30', 'separator' => '20', 'mobile_separator' => '', 'left_sidebar_width' => '30', 'right_sidebar_width' => '30', 'widget_top' => '40', 'widget_right' => '40', 'widget_bottom' => '40', 'widget_left' => '40', 'footer_widget_container_top' => '40', 'footer_widget_container_right' => '40', 'footer_widget_container_bottom' => '40', 'footer_widget_container_left' => '40', 'footer_widget_separator' => '40', 'footer_top' => '20', 'footer_right' => '40', 'footer_bottom' => '20', 'footer_left' => '40', 'mobile_footer_top' => '', 'mobile_footer_right' => '30', 'mobile_footer_bottom' => '', 'mobile_footer_left' => '30', ); if ( $filter ) { return apply_filters( 'generate_spacing_option_defaults', $defaults ); } return $defaults; } } if ( ! function_exists( 'generate_typography_default_fonts' ) ) { /** * Set the default system fonts. * * @since 1.3.40 */ function generate_typography_default_fonts() { $fonts = array( 'inherit', 'System Stack', 'Arial, Helvetica, sans-serif', 'Century Gothic', 'Comic Sans MS', 'Courier New', 'Georgia, Times New Roman, Times, serif', 'Helvetica', 'Impact', 'Lucida Console', 'Lucida Sans Unicode', 'Palatino Linotype', 'Segoe UI, Helvetica Neue, Helvetica, sans-serif', 'Tahoma, Geneva, sans-serif', 'Trebuchet MS, Helvetica, sans-serif', 'Verdana, Geneva, sans-serif', ); return apply_filters( 'generate_typography_default_fonts', $fonts ); } } PK C\Ȭ5M 5M inc/block-editor.phpnu [ post_type ) { $layout = generate_get_option( 'single_layout_setting' ); } } // Add in our default filter in case people have adjusted it. $layout = apply_filters( 'generate_sidebar_layout', $layout ); if ( $meta ) { $layout_meta = get_post_meta( get_the_ID(), '_generate-sidebar-layout-meta', true ); if ( $layout_meta ) { $layout = $layout_meta; } } return apply_filters( 'generate_block_editor_sidebar_layout', $layout ); } /** * Check whether we're disabling the content title or not. * We need this function as the post meta in generate_show_title() only runs * on is_singular() * * @since 2.2 */ function generate_get_block_editor_show_content_title() { $title = generate_show_title(); $disable_title = get_post_meta( get_the_ID(), '_generate-disable-headline', true ); if ( $disable_title ) { $title = false; } return apply_filters( 'generate_block_editor_show_content_title', $title ); } /** * Get the content width for this post. * * @since 2.2 */ function generate_get_block_editor_content_width() { $container_width = generate_get_option( 'container_width' ); $content_width = $container_width; $right_sidebar_width = apply_filters( 'generate_right_sidebar_width', '25' ); $left_sidebar_width = apply_filters( 'generate_left_sidebar_width', '25' ); $layout = generate_get_block_editor_sidebar_layout(); if ( 'left-sidebar' === $layout ) { $content_width = $container_width * ( ( 100 - $left_sidebar_width ) / 100 ); } elseif ( 'right-sidebar' === $layout ) { $content_width = $container_width * ( ( 100 - $right_sidebar_width ) / 100 ); } elseif ( 'no-sidebar' === $layout ) { $content_width = $container_width; } else { $content_width = $container_width * ( ( 100 - ( $left_sidebar_width + $right_sidebar_width ) ) / 100 ); } return apply_filters( 'generate_block_editor_content_width', $content_width ); } add_filter( 'block_editor_settings_all', 'generate_add_inline_block_editor_styles' ); /** * Add dynamic inline styles to the block editor content. * * @param array $editor_settings The existing editor settings. */ function generate_add_inline_block_editor_styles( $editor_settings ) { $show_editor_styles = apply_filters( 'generate_show_block_editor_styles', true ); if ( $show_editor_styles ) { if ( generate_is_using_dynamic_typography() ) { $google_fonts_uri = GeneratePress_Typography::get_google_fonts_uri(); if ( $google_fonts_uri ) { // Need to use @import for now until this is ready: https://github.com/WordPress/gutenberg/pull/35950. $google_fonts_import = sprintf( '@import "%s";', $google_fonts_uri ); $editor_settings['styles'][] = array( 'css' => $google_fonts_import ); } } $editor_settings['styles'][] = array( 'css' => wp_strip_all_tags( generate_do_inline_block_editor_css() ) ); if ( generate_is_using_dynamic_typography() ) { $editor_settings['styles'][] = array( 'css' => wp_strip_all_tags( GeneratePress_Typography::get_css( 'core' ) ) ); } } return $editor_settings; } add_action( 'enqueue_block_editor_assets', 'generate_enqueue_google_fonts' ); add_action( 'enqueue_block_editor_assets', 'generate_enqueue_backend_block_editor_assets' ); /** * Add CSS to the admin side of the block editor. * * @since 2.2 */ function generate_enqueue_backend_block_editor_assets() { wp_enqueue_script( 'generate-block-editor', trailingslashit( get_template_directory_uri() ) . 'assets/dist/block-editor.js', array( 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-plugins', 'wp-polyfill' ), GENERATE_VERSION, true ); $color_settings = wp_parse_args( get_option( 'generate_settings', array() ), generate_get_color_defaults() ); $spacing_settings = wp_parse_args( get_option( 'generate_spacing_settings', array() ), generate_spacing_get_defaults() ); $text_color = generate_get_option( 'text_color' ); if ( $color_settings['content_text_color'] ) { $text_color = $color_settings['content_text_color']; } $sidebar_layout = get_post_meta( get_the_ID(), '_generate_sidebar_layout', true ); $content_area_type = get_post_meta( get_the_ID(), '_generate-full-width-content', true ); wp_localize_script( 'generate-block-editor', 'generatepressBlockEditor', array( 'sidebarLayout' => $sidebar_layout ? $sidebar_layout : generate_get_block_editor_sidebar_layout( false ), 'containerWidth' => generate_get_option( 'container_width' ), 'contentPaddingRight' => absint( $spacing_settings['content_right'] ) . 'px', 'contentPaddingLeft' => absint( $spacing_settings['content_left'] ) . 'px', 'rightSidebarWidth' => apply_filters( 'generate_right_sidebar_width', '25' ), 'leftSidebarWidth' => apply_filters( 'generate_left_sidebar_width', '25' ), 'text_color' => $text_color, 'show_editor_styles' => apply_filters( 'generate_show_block_editor_styles', true ), 'contentAreaType' => $content_area_type ? $content_area_type : apply_filters( 'generate_block_editor_content_area_type', '' ), 'customContentWidth' => apply_filters( 'generate_block_editor_container_width', '' ), ) ); wp_register_style( 'generate-block-editor', false, array(), true, true ); wp_add_inline_style( 'generate-block-editor', generate_do_inline_block_editor_css( 'block-editor' ) ); wp_enqueue_style( 'generate-block-editor' ); } /** * Write our CSS for the block editor. * * @since 2.2 * @param string $for Define whether this CSS for the block content or the block editor. */ function generate_do_inline_block_editor_css( $for = 'block-content' ) { $css = new GeneratePress_CSS(); $css->set_selector( ':root' ); $global_colors = generate_get_global_colors(); if ( ! empty( $global_colors ) ) { foreach ( (array) $global_colors as $key => $data ) { if ( ! empty( $data['slug'] ) && ! empty( $data['color'] ) ) { $css->add_property( '--' . $data['slug'], $data['color'] ); } } foreach ( (array) $global_colors as $key => $data ) { if ( ! empty( $data['slug'] ) && ! empty( $data['color'] ) ) { $css->set_selector( '.has-' . $data['slug'] . '-color' ); $css->add_property( 'color', 'var(--' . $data['slug'] . ')' ); $css->set_selector( '.has-' . $data['slug'] . '-background-color' ); $css->add_property( 'background-color', 'var(--' . $data['slug'] . ')' ); } } } // If this CSS is for the editor only (not the block content), we can return here. if ( 'block-editor' === $for ) { return $css->css_output(); } $color_settings = wp_parse_args( get_option( 'generate_settings', array() ), generate_get_color_defaults() ); $font_settings = wp_parse_args( get_option( 'generate_settings', array() ), generate_get_default_fonts() ); $content_width = generate_get_block_editor_content_width(); $spacing_settings = wp_parse_args( get_option( 'generate_spacing_settings', array() ), generate_spacing_get_defaults() ); $content_width_calc = sprintf( 'calc(%1$s - %2$s - %3$s)', absint( $content_width ) . 'px', absint( $spacing_settings['content_left'] ) . 'px', absint( $spacing_settings['content_right'] ) . 'px' ); $css->set_selector( 'body' ); $css->add_property( '--content-width', 'true' === get_post_meta( get_the_ID(), '_generate-full-width-content', true ) ? '100%' : $content_width_calc ); $css->set_selector( 'body .wp-block' ); $css->add_property( 'max-width', 'var(--content-width)' ); $css->set_selector( '.wp-block[data-align="full"]' ); $css->add_property( 'max-width', 'none' ); $css->set_selector( '.wp-block[data-align="wide"]' ); $css->add_property( 'max-width', absint( $content_width ), false, 'px' ); $underline_links = generate_get_option( 'underline_links' ); if ( 'never' !== $underline_links ) { if ( 'always' === $underline_links ) { $css->set_selector( ':where(.wp-block a)' ); $css->add_property( 'text-decoration', 'underline' ); } if ( 'hover' === $underline_links ) { $css->set_selector( ':where(.wp-block a)' ); $css->add_property( 'text-decoration', 'none' ); $css->set_selector( ':where(.wp-block a:hover), :where(.wp-block a:focus)' ); $css->add_property( 'text-decoration', 'underline' ); } if ( 'not-hover' === $underline_links ) { $css->set_selector( ':where(.wp-block a)' ); $css->add_property( 'text-decoration', 'underline' ); $css->set_selector( ':where(.wp-block a:hover), :where(.wp-block a:focus)' ); $css->add_property( 'text-decoration', 'none' ); } $css->set_selector( 'a.button, .wp-block-button__link' ); $css->add_property( 'text-decoration', 'none' ); } else { $css->set_selector( '.wp-block a' ); $css->add_property( 'text-decoration', 'none' ); } if ( apply_filters( 'generate_do_group_inner_container_style', true ) ) { $css->set_selector( '.wp-block-group__inner-container' ); $css->add_property( 'max-width', absint( $content_width ), false, 'px' ); $css->add_property( 'margin-left', 'auto' ); $css->add_property( 'margin-right', 'auto' ); $css->add_property( 'padding', generate_padding_css( $spacing_settings['content_top'], $spacing_settings['content_right'], $spacing_settings['content_bottom'], $spacing_settings['content_left'] ) ); } $css->set_selector( 'a.button, a.button:visited, .wp-block-button__link:not(.has-background)' ); $css->add_property( 'color', $color_settings['form_button_text_color'] ); $css->add_property( 'background-color', $color_settings['form_button_background_color'] ); $css->add_property( 'padding', '10px 20px' ); $css->add_property( 'border', '0' ); $css->add_property( 'border-radius', '0' ); $css->set_selector( 'a.button:hover, a.button:active, a.button:focus, .wp-block-button__link:not(.has-background):active, .wp-block-button__link:not(.has-background):focus, .wp-block-button__link:not(.has-background):hover' ); $css->add_property( 'color', $color_settings['form_button_text_color_hover'] ); $css->add_property( 'background-color', $color_settings['form_button_background_color_hover'] ); if ( ! generate_is_using_dynamic_typography() ) { $body_family = generate_get_font_family_css( 'font_body', 'generate_settings', generate_get_default_fonts() ); $h1_family = generate_get_font_family_css( 'font_heading_1', 'generate_settings', generate_get_default_fonts() ); $h2_family = generate_get_font_family_css( 'font_heading_2', 'generate_settings', generate_get_default_fonts() ); $h3_family = generate_get_font_family_css( 'font_heading_3', 'generate_settings', generate_get_default_fonts() ); $h4_family = generate_get_font_family_css( 'font_heading_4', 'generate_settings', generate_get_default_fonts() ); $h5_family = generate_get_font_family_css( 'font_heading_5', 'generate_settings', generate_get_default_fonts() ); $h6_family = generate_get_font_family_css( 'font_heading_6', 'generate_settings', generate_get_default_fonts() ); $buttons_family = generate_get_font_family_css( 'font_buttons', 'generate_settings', generate_get_default_fonts() ); } $css->set_selector( 'body' ); if ( ! generate_is_using_dynamic_typography() ) { $css->add_property( 'font-family', $body_family ); $css->add_property( 'font-size', absint( $font_settings['body_font_size'] ), false, 'px' ); } if ( $color_settings['content_text_color'] ) { $css->add_property( 'color', $color_settings['content_text_color'] ); } else { $css->add_property( 'color', generate_get_option( 'text_color' ) ); } $css->set_selector( '.content-title-visibility' ); if ( $color_settings['content_text_color'] ) { $css->add_property( 'color', $color_settings['content_text_color'] ); } else { $css->add_property( 'color', generate_get_option( 'text_color' ) ); } if ( ! generate_is_using_dynamic_typography() ) { $css->set_selector( 'body, p' ); $css->add_property( 'line-height', floatval( $font_settings['body_line_height'] ) ); $css->set_selector( 'p' ); $css->add_property( 'margin-top', '0px' ); $css->add_property( 'margin-bottom', $font_settings['paragraph_margin'], false, 'em' ); } $css->set_selector( 'h1' ); if ( ! generate_is_using_dynamic_typography() ) { $css->add_property( 'font-family', 'inherit' === $h1_family || '' === $h1_family ? $body_family : $h1_family ); $css->add_property( 'font-weight', $font_settings['heading_1_weight'] ); $css->add_property( 'text-transform', $font_settings['heading_1_transform'] ); $css->add_property( 'font-size', absint( $font_settings['heading_1_font_size'] ), false, 'px' ); $css->add_property( 'line-height', floatval( $font_settings['heading_1_line_height'] ), false, 'em' ); $css->add_property( 'margin-bottom', floatval( $font_settings['heading_1_margin_bottom'] ), false, 'px' ); $css->add_property( 'margin-top', '0' ); } $css->add_property( 'color', $color_settings['h1_color'] ); if ( $color_settings['content_title_color'] ) { $css->set_selector( '.edit-post-visual-editor__post-title-wrapper h1' ); $css->add_property( 'color', $color_settings['content_title_color'] ); } $css->set_selector( 'h2' ); if ( ! generate_is_using_dynamic_typography() ) { $css->add_property( 'font-family', $h2_family ); $css->add_property( 'font-weight', $font_settings['heading_2_weight'] ); $css->add_property( 'text-transform', $font_settings['heading_2_transform'] ); $css->add_property( 'font-size', absint( $font_settings['heading_2_font_size'] ), false, 'px' ); $css->add_property( 'line-height', floatval( $font_settings['heading_2_line_height'] ), false, 'em' ); $css->add_property( 'margin-bottom', floatval( $font_settings['heading_2_margin_bottom'] ), false, 'px' ); $css->add_property( 'margin-top', '0' ); } $css->add_property( 'color', $color_settings['h2_color'] ); $css->set_selector( 'h3' ); if ( ! generate_is_using_dynamic_typography() ) { $css->add_property( 'font-family', $h3_family ); $css->add_property( 'font-weight', $font_settings['heading_3_weight'] ); $css->add_property( 'text-transform', $font_settings['heading_3_transform'] ); $css->add_property( 'font-size', absint( $font_settings['heading_3_font_size'] ), false, 'px' ); $css->add_property( 'line-height', floatval( $font_settings['heading_3_line_height'] ), false, 'em' ); $css->add_property( 'margin-bottom', floatval( $font_settings['heading_3_margin_bottom'] ), false, 'px' ); $css->add_property( 'margin-top', '0' ); } $css->add_property( 'color', $color_settings['h3_color'] ); $css->set_selector( 'h4' ); if ( ! generate_is_using_dynamic_typography() ) { $css->add_property( 'font-family', $h4_family ); $css->add_property( 'font-weight', $font_settings['heading_4_weight'] ); $css->add_property( 'text-transform', $font_settings['heading_4_transform'] ); $css->add_property( 'margin-bottom', '20px' ); $css->add_property( 'margin-top', '0' ); if ( '' !== $font_settings['heading_4_font_size'] ) { $css->add_property( 'font-size', absint( $font_settings['heading_4_font_size'] ), false, 'px' ); } else { $css->add_property( 'font-size', 'inherit' ); } if ( '' !== $font_settings['heading_4_line_height'] ) { $css->add_property( 'line-height', floatval( $font_settings['heading_4_line_height'] ), false, 'em' ); } } $css->add_property( 'color', $color_settings['h4_color'] ); $css->set_selector( 'h5' ); if ( ! generate_is_using_dynamic_typography() ) { $css->add_property( 'font-family', $h5_family ); $css->add_property( 'font-weight', $font_settings['heading_5_weight'] ); $css->add_property( 'text-transform', $font_settings['heading_5_transform'] ); $css->add_property( 'margin-bottom', '20px' ); $css->add_property( 'margin-top', '0' ); if ( '' !== $font_settings['heading_5_font_size'] ) { $css->add_property( 'font-size', absint( $font_settings['heading_5_font_size'] ), false, 'px' ); } else { $css->add_property( 'font-size', 'inherit' ); } if ( '' !== $font_settings['heading_5_line_height'] ) { $css->add_property( 'line-height', floatval( $font_settings['heading_5_line_height'] ), false, 'em' ); } } $css->add_property( 'color', $color_settings['h5_color'] ); $css->set_selector( 'h6' ); if ( ! generate_is_using_dynamic_typography() ) { $css->add_property( 'font-family', $h6_family ); $css->add_property( 'font-weight', $font_settings['heading_6_weight'] ); $css->add_property( 'text-transform', $font_settings['heading_6_transform'] ); $css->add_property( 'margin-bottom', '20px' ); $css->add_property( 'margin-top', '0' ); if ( '' !== $font_settings['heading_6_font_size'] ) { $css->add_property( 'font-size', absint( $font_settings['heading_6_font_size'] ), false, 'px' ); } else { $css->add_property( 'font-size', 'inherit' ); } if ( '' !== $font_settings['heading_6_line_height'] ) { $css->add_property( 'line-height', floatval( $font_settings['heading_6_line_height'] ), false, 'em' ); } } $css->add_property( 'color', $color_settings['h6_color'] ); $css->set_selector( 'a.button, .block-editor-block-list__layout .wp-block-button .wp-block-button__link' ); if ( ! generate_is_using_dynamic_typography() ) { $css->add_property( 'font-family', $buttons_family ); $css->add_property( 'font-weight', $font_settings['buttons_font_weight'] ); $css->add_property( 'text-transform', $font_settings['buttons_font_transform'] ); if ( '' !== $font_settings['buttons_font_size'] ) { $css->add_property( 'font-size', absint( $font_settings['buttons_font_size'] ), false, 'px' ); } else { $css->add_property( 'font-size', 'inherit' ); } } if ( version_compare( $GLOBALS['wp_version'], '5.7-alpha.1', '>' ) ) { $css->set_selector( '.block-editor__container .edit-post-visual-editor' ); $css->add_property( 'background-color', generate_get_option( 'background_color' ) ); $css->set_selector( 'body' ); if ( $color_settings['content_background_color'] ) { $css->add_property( 'background-color', $color_settings['content_background_color'] ); } else { $css->add_property( 'background-color', generate_get_option( 'background_color' ) ); } } else { $css->set_selector( 'body' ); $css->add_property( 'background-color', generate_get_option( 'background_color' ) ); if ( $color_settings['content_background_color'] ) { $body_background = generate_get_option( 'background_color' ); $content_background = $color_settings['content_background_color']; $css->add_property( 'background', 'linear-gradient(' . $content_background . ',' . $content_background . '), linear-gradient(' . $body_background . ',' . $body_background . ')' ); } } $css->set_selector( 'a' ); if ( $color_settings['content_link_color'] ) { $css->add_property( 'color', $color_settings['content_link_color'] ); } else { $css->add_property( 'color', generate_get_option( 'link_color' ) ); } $css->set_selector( 'a:hover, a:focus, a:active' ); if ( $color_settings['content_link_hover_color'] ) { $css->add_property( 'color', $color_settings['content_link_hover_color'] ); } else { $css->add_property( 'color', generate_get_option( 'link_color_hover' ) ); } return $css->css_output(); } PK C\7ޟ inc/structure/comments.phpnu [ comment_type || 'trackback' === $comment->comment_type ) : ?>
>
', '' ); ?>
>
get_comment_ID() ) ); ?>>
'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => '
', 'after' => '
', ) ) ); } add_filter( 'comment_form_defaults', 'generate_set_comment_form_defaults' ); /** * Set the default settings for our comments. * * @since 2.3 * * @param array $defaults The existing defaults. * @return array */ function generate_set_comment_form_defaults( $defaults ) { $defaults['comment_field'] = sprintf( '
%1$s
</textarea>
', esc_html__( 'Comment', 'generatepress' ) ); $defaults['comment_notes_before'] = ''; $defaults['comment_notes_after'] = ''; $defaults['id_form'] = 'commentform'; $defaults['id_submit'] = 'submit'; $defaults['title_reply'] = apply_filters( 'generate_leave_comment', __( 'Leave a Comment', 'generatepress' ) ); $defaults['label_submit'] = apply_filters( 'generate_post_comment', __( 'Post Comment', 'generatepress' ) ); return $defaults; } add_filter( 'comment_form_default_fields', 'generate_filter_comment_fields' ); /** * Customizes the existing comment fields. * * @since 2.1.2 * @param array $fields The existing fields. * @return array */ function generate_filter_comment_fields( $fields ) { $commenter = wp_get_current_commenter(); $required = get_option( 'require_name_email' ); $fields['author'] = sprintf( '
%1$s
', esc_html__( 'Name', 'generatepress' ), esc_attr( $commenter['comment_author'] ), $required ? ' *' : '', $required ? ' required' : '' ); $fields['email'] = sprintf( '
%1$s
', esc_html__( 'Email', 'generatepress' ), esc_attr( $commenter['comment_author_email'] ), $required ? ' *' : '', $required ? ' required' : '' ); $fields['url'] = sprintf( '
%1$s
', esc_html__( 'Website', 'generatepress' ), esc_attr( $commenter['comment_author_url'] ) ); return $fields; } add_action( 'generate_after_do_template_part', 'generate_do_comments_template', 15 ); /** * Add the comments template to pages and single posts. * * @since 3.0.0 * @param string $template The template we're targeting. */ function generate_do_comments_template( $template ) { if ( 'single' === $template || 'page' === $template ) { // If comments are open or we have at least one comment, load up the comment template. // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Intentionally loose. if ( comments_open() || '0' != get_comments_number() ) : /** * generate_before_comments_container hook. * * @since 2.1 */ do_action( 'generate_before_comments_container' ); ?>
>
>
'header-image is-logo-image', 'alt' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ), 'src' => $logo_url, ) ); $data = get_theme_mod( 'custom_logo' ) && ( '' !== $retina_logo_url || generate_is_using_flexbox() ) ? wp_get_attachment_metadata( get_theme_mod( 'custom_logo' ) ) : false; if ( '' !== $retina_logo_url ) { $attr['srcset'] = $logo_url . ' 1x, ' . $retina_logo_url . ' 2x'; } if ( $data ) { if ( isset( $data['width'] ) ) { $attr['width'] = $data['width']; } if ( isset( $data['height'] ) ) { $attr['height'] = $data['height']; } } $attr = array_map( 'esc_attr', $attr ); $html_attr = ''; foreach ( $attr as $name => $value ) { $html_attr .= " $name=" . '"' . $value . '"'; } // Print our HTML. echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 'generate_logo_output', sprintf( '
', esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ), $html_attr ), $logo_url, $html_attr ); /** * generate_after_logo hook. * * @since 0.1 */ do_action( 'generate_after_logo' ); } } if ( ! function_exists( 'generate_construct_site_title' ) ) { /** * Build the site title and tagline. * * @since 1.3.28 */ function generate_construct_site_title() { $generate_settings = wp_parse_args( get_option( 'generate_settings', array() ), generate_get_defaults() ); // Get the title and tagline. $title = get_bloginfo( 'title' ); $tagline = get_bloginfo( 'description' ); // If the disable title checkbox is checked, or the title field is empty, return true. $disable_title = ( '1' == $generate_settings['hide_title'] || '' == $title ) ? true : false; // phpcs:ignore // If the disable tagline checkbox is checked, or the tagline field is empty, return true. $disable_tagline = ( '1' == $generate_settings['hide_tagline'] || '' == $tagline ) ? true : false; // phpcs:ignore $schema_type = generate_get_schema_type(); // Build our site title. $site_title = apply_filters( 'generate_site_title_output', sprintf( '<%1$s class="main-title"%4$s>
%3$s
%1$s>', ( is_front_page() && is_home() ) ? 'h1' : 'p', esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ), get_bloginfo( 'name' ), 'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : '' ) ); // Build our tagline. $site_tagline = apply_filters( 'generate_site_description_output', sprintf( '
%1$s
', html_entity_decode( get_bloginfo( 'description', 'display' ) ), // phpcs:ignore 'microdata' === generate_get_schema_type() ? ' itemprop="description"' : '' ) ); // Site title and tagline. if ( false === $disable_title || false === $disable_tagline ) { if ( generate_needs_site_branding_container() ) { echo '
'; generate_construct_logo(); } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- outputting site title and tagline. False positive. echo apply_filters( 'generate_site_branding_output', sprintf( '
%1$s %2$s
', ( ! $disable_title ) ? $site_title : '', ( ! $disable_tagline ) ? $site_tagline : '' ) ); if ( generate_needs_site_branding_container() ) { echo '
'; } } } } add_filter( 'generate_header_items_order', 'generate_reorder_inline_site_branding' ); /** * Remove the logo from it's usual position. * * @since 2.3 * @param array $order Order of the header items. */ function generate_reorder_inline_site_branding( $order ) { if ( ! generate_get_option( 'inline_logo_site_branding' ) || ! generate_has_logo_site_branding() ) { return $order; } return array( 'header-widget', 'site-branding', ); } if ( ! function_exists( 'generate_construct_header_widget' ) ) { /** * Build the header widget. * * @since 1.3.28 */ function generate_construct_header_widget() { if ( is_active_sidebar( 'header' ) ) : ?>
>
>
' . "\n", esc_url( get_bloginfo( 'pingback_url' ) ) ); } } } if ( ! function_exists( 'generate_add_viewport' ) ) { add_action( 'wp_head', 'generate_add_viewport', 1 ); /** * Add viewport to wp_head. * * @since 1.1.0 */ function generate_add_viewport() { echo apply_filters( 'generate_meta_viewport', '
' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } add_action( 'generate_before_header', 'generate_do_skip_to_content_link', 2 ); /** * Add skip to content link before the header. * * @since 2.0 */ function generate_do_skip_to_content_link() { printf( '
%2$s
', esc_attr__( 'Skip to content', 'generatepress' ), esc_html__( 'Skip to content', 'generatepress' ) ); } PK C\