updated plugin GP Premium version 1.12.2

This commit is contained in:
KawaiiPunk 2020-10-20 15:16:06 +00:00 committed by Gitium
parent 7b5257d924
commit dcc1a6ca18
57 changed files with 1566 additions and 1660 deletions

View File

@ -127,7 +127,8 @@
margin-left: 0; margin-left: 0;
margin-right: 0; margin-right: 0;
} }
.generate-columns-container > * { .generate-columns-container > *,
.generate-columns-container .generate-columns {
padding-left: 0; padding-left: 0;
} }
.generate-columns-container .page-header { .generate-columns-container .page-header {

View File

@ -1 +1 @@
.masonry-enabled .page-header{position:relative!important}.separate-containers .site-main>.generate-columns-container{margin-bottom:0}.load-more.are-images-unloaded,.masonry-container.are-images-unloaded,.masonry-enabled #nav-below{opacity:0}.generate-columns-container:not(.masonry-container){display:flex;flex-flow:row wrap;align-items:stretch}.generate-columns-container:not(.masonry-container) .generate-columns{display:flex}.generate-columns .inside-article{width:100%;box-sizing:border-box}.generate-columns-activated.post-image-aligned-left .generate-columns-container article:not(.featured-column) .post-image,.generate-columns-activated.post-image-aligned-right .generate-columns-container article:not(.featured-column) .post-image{float:none;text-align:center;margin-left:0;margin-right:0}.generate-columns-container .page-header,.generate-columns-container .paging-navigation{flex:1 1 100%;clear:both}.generate-columns-container .paging-navigation{margin-bottom:0}.no-sidebar .generate-columns-container .inside-article>*{max-width:none}.load-more:not(.has-svg-icon) .button.loading:before{content:"\e900";display:inline-block;font-family:"GP Premium";font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;animation:spin 2s infinite linear;margin-right:7px}.load-more .button:not(.loading) .gp-icon{display:none}.load-more .gp-icon svg{animation:spin 2s infinite linear;margin-right:7px}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.generate-columns{box-sizing:border-box}.generate-columns.grid-20,.grid-sizer.grid-20{width:20%}.generate-columns.grid-25,.grid-sizer.grid-25{width:25%}.generate-columns.grid-33,.grid-sizer.grid-33{width:33.3333%}.generate-columns.grid-50,.grid-sizer.grid-50{width:50%}.generate-columns.grid-60,.grid-sizer.grid-60{width:60%}.generate-columns.grid-66,.grid-sizer.grid-66{width:66.66667%}@media (min-width:768px) and (max-width:1024px){.generate-columns.tablet-grid-50,.grid-sizer.tablet-grid-50{width:50%}}@media (max-width:767px){.generate-columns-activated .generate-columns-container{margin-left:0;margin-right:0}.generate-columns-container>*{padding-left:0}.generate-columns-container .page-header{margin-left:0}.generate-columns.mobile-grid-100,.grid-sizer.mobile-grid-100{width:100%}.generate-columns-container>.paging-navigation{margin-left:0}}@media (max-width:768px){.load-more{display:block;text-align:center;margin-bottom:0}} .masonry-enabled .page-header{position:relative!important}.separate-containers .site-main>.generate-columns-container{margin-bottom:0}.load-more.are-images-unloaded,.masonry-container.are-images-unloaded,.masonry-enabled #nav-below{opacity:0}.generate-columns-container:not(.masonry-container){display:flex;flex-flow:row wrap;align-items:stretch}.generate-columns-container:not(.masonry-container) .generate-columns{display:flex}.generate-columns .inside-article{width:100%;box-sizing:border-box}.generate-columns-activated.post-image-aligned-left .generate-columns-container article:not(.featured-column) .post-image,.generate-columns-activated.post-image-aligned-right .generate-columns-container article:not(.featured-column) .post-image{float:none;text-align:center;margin-left:0;margin-right:0}.generate-columns-container .page-header,.generate-columns-container .paging-navigation{flex:1 1 100%;clear:both}.generate-columns-container .paging-navigation{margin-bottom:0}.no-sidebar .generate-columns-container .inside-article>*{max-width:none}.load-more:not(.has-svg-icon) .button.loading:before{content:"\e900";display:inline-block;font-family:"GP Premium";font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;animation:spin 2s infinite linear;margin-right:7px}.load-more .button:not(.loading) .gp-icon{display:none}.load-more .gp-icon svg{animation:spin 2s infinite linear;margin-right:7px}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.generate-columns{box-sizing:border-box}.generate-columns.grid-20,.grid-sizer.grid-20{width:20%}.generate-columns.grid-25,.grid-sizer.grid-25{width:25%}.generate-columns.grid-33,.grid-sizer.grid-33{width:33.3333%}.generate-columns.grid-50,.grid-sizer.grid-50{width:50%}.generate-columns.grid-60,.grid-sizer.grid-60{width:60%}.generate-columns.grid-66,.grid-sizer.grid-66{width:66.66667%}@media (min-width:768px) and (max-width:1024px){.generate-columns.tablet-grid-50,.grid-sizer.tablet-grid-50{width:50%}}@media (max-width:767px){.generate-columns-activated .generate-columns-container{margin-left:0;margin-right:0}.generate-columns-container .generate-columns,.generate-columns-container>*{padding-left:0}.generate-columns-container .page-header{margin-left:0}.generate-columns.mobile-grid-100,.grid-sizer.mobile-grid-100{width:100%}.generate-columns-container>.paging-navigation{margin-left:0}}@media (max-width:768px){.load-more{display:block;text-align:center;margin-bottom:0}}

View File

@ -238,7 +238,8 @@
margin-left: 0; margin-left: 0;
margin-right: 0; margin-right: 0;
} }
.generate-columns-container > * { .generate-columns-container > *,
.generate-columns-container .generate-columns {
padding-left: 0; padding-left: 0;
} }
.generate-columns-container .page-header { .generate-columns-container .page-header {

File diff suppressed because one or more lines are too long

View File

@ -94,7 +94,7 @@ if ( ! function_exists( 'generate_blog_scripts' ) ) {
$needs_columns_css = false; $needs_columns_css = false;
$needs_featured_image_css = false; $needs_featured_image_css = false;
if ( ( ! is_singular() && $settings['column_layout'] ) || $settings['infinite_scroll'] ) { if ( generate_blog_get_columns() || $settings['infinite_scroll'] ) {
$needs_columns_css = true; $needs_columns_css = true;
} }

View File

@ -63,6 +63,7 @@ jQuery( document ).ready( function( $ ) {
} }
$button.html( svgIcon + generateBlog.more ).removeClass( 'loading' ); $button.html( svgIcon + generateBlog.more ).removeClass( 'loading' );
$( document.body ).trigger( 'post-load' );
} ); } );
$container.on( 'last.infiniteScroll', function() { $container.on( 'last.infiniteScroll', function() {

View File

@ -1 +1 @@
jQuery(document).ready(function(t){var i,r,l,s,n,e=t(".masonry-container"),o=!1;e.length&&(o=(i=e.masonry(generateBlog.masonryInit)).data("masonry"),i.imagesLoaded(function(){i.masonry("layout"),i.removeClass("are-images-unloaded"),t(".load-more").removeClass("are-images-unloaded"),t("#nav-below").css("opacity","1"),i.masonry("option",{itemSelector:".masonry-post"});var n=i.find(".masonry-post");i.masonry("appended",n)}),t("#nav-below").insertAfter(".masonry-container"),t(window).on("orientationchange",function(n){i.masonry("layout")})),t(".infinite-scroll").length&&t(".nav-links .next").length&&(r=t("#main article").first().parent(),l=t(".load-more a"),s="",generateBlog.icon&&(s=generateBlog.icon),(n=generateBlog.infiniteScrollInit).outlayer=o,r.infiniteScroll(n),l.on("click",function(n){document.activeElement.blur(),t(this).html(s+generateBlog.loading).addClass("loading")}),r.on("append.infiniteScroll",function(n,e,o,a){t(".generate-columns-container").length||r.append(l.parent()),t(a).find("img").each(function(n,e){var o=e.outerHTML;e.outerHTML=o}),i&&i.imagesLoaded(function(){i.masonry("layout")}),l.html(s+generateBlog.more).removeClass("loading")}),r.on("last.infiniteScroll",function(){t(".load-more").hide()}))}); jQuery(document).ready(function(t){var i,r,l,s,n,e=t(".masonry-container"),o=!1;e.length&&(o=(i=e.masonry(generateBlog.masonryInit)).data("masonry"),i.imagesLoaded(function(){i.masonry("layout"),i.removeClass("are-images-unloaded"),t(".load-more").removeClass("are-images-unloaded"),t("#nav-below").css("opacity","1"),i.masonry("option",{itemSelector:".masonry-post"});var n=i.find(".masonry-post");i.masonry("appended",n)}),t("#nav-below").insertAfter(".masonry-container"),t(window).on("orientationchange",function(n){i.masonry("layout")})),t(".infinite-scroll").length&&t(".nav-links .next").length&&(r=t("#main article").first().parent(),l=t(".load-more a"),s="",generateBlog.icon&&(s=generateBlog.icon),(n=generateBlog.infiniteScrollInit).outlayer=o,r.infiniteScroll(n),l.on("click",function(n){document.activeElement.blur(),t(this).html(s+generateBlog.loading).addClass("loading")}),r.on("append.infiniteScroll",function(n,e,o,a){t(".generate-columns-container").length||r.append(l.parent()),t(a).find("img").each(function(n,e){var o=e.outerHTML;e.outerHTML=o}),i&&i.imagesLoaded(function(){i.masonry("layout")}),l.html(s+generateBlog.more).removeClass("loading"),t(document.body).trigger("post-load")}),r.on("last.infiniteScroll",function(){t(".load-more").hide()}))});

View File

@ -260,9 +260,9 @@ generate_colors_live_update( 'navigation_text_color',
wp.customize( 'generate_settings[navigation_search_background_color]', function( value ) { wp.customize( 'generate_settings[navigation_search_background_color]', function( value ) {
value.bind( function( newval ) { value.bind( function( newval ) {
if ( jQuery( 'style#navigation_search_background_color' ).length ) { if ( jQuery( 'style#navigation_search_background_color' ).length ) {
jQuery( 'style#navigation_search_background_color' ).html( '.navigation-search input[type="search"],.navigation-search input[type="search"]:active, .navigation-search input[type="search"]:focus, .main-navigation .main-nav ul li.search-item.active > a{background-color:' + newval + ';}' ); jQuery( 'style#navigation_search_background_color' ).html( '.navigation-search input[type="search"],.navigation-search input[type="search"]:active, .navigation-search input[type="search"]:focus, .main-navigation .main-nav ul li.search-item.active > a, .main-navigation .menu-bar-items .search-item.active > a{background-color:' + newval + ';}' );
} else { } else {
jQuery( 'head' ).append( '<style id="navigation_search_background_color">.navigation-search input[type="search"],.navigation-search input[type="search"]:active, .navigation-search input[type="search"]:focus, .main-navigation .main-nav ul li.search-item.active > a{background-color:' + newval + ';}</style>' ); jQuery( 'head' ).append( '<style id="navigation_search_background_color">.navigation-search input[type="search"],.navigation-search input[type="search"]:active, .navigation-search input[type="search"]:focus, .main-navigation .main-nav ul li.search-item.active > a, .main-navigation .menu-bar-items .search-item.active > a{background-color:' + newval + ';}</style>' );
setTimeout(function() { setTimeout(function() {
jQuery( 'style#navigation_search_background_color' ).not( ':last' ).remove(); jQuery( 'style#navigation_search_background_color' ).not( ':last' ).remove();
}, 1000); }, 1000);
@ -286,7 +286,7 @@ wp.customize( 'generate_settings[navigation_search_background_color]', function(
} ); } );
} ); } );
generate_colors_live_update( 'navigation_search_text_color', '.navigation-search input[type="search"],.navigation-search input[type="search"]:active, .navigation-search input[type="search"]:focus, .main-navigation .main-nav ul li.search-item.active > a', 'color', '' ); generate_colors_live_update( 'navigation_search_text_color', '.navigation-search input[type="search"],.navigation-search input[type="search"]:active, .navigation-search input[type="search"]:focus, .main-navigation .main-nav ul li.search-item.active > a, .main-navigation .menu-bar-items .search-item.active > a', 'color', '' );
/** /**
* Secondary navigation text color hover * Secondary navigation text color hover

File diff suppressed because one or more lines are too long

View File

@ -80,10 +80,10 @@ class GeneratePress_Block_Element {
case 'left-sidebar': case 'left-sidebar':
$hook = 'generate_before_left_sidebar_content'; $hook = 'generate_before_left_sidebar_content';
break; break;
}
case 'custom': if ( 'custom' === $hook && $custom_hook ) {
$hook = $custom_hook; $hook = $custom_hook;
break;
} }
if ( ! $hook ) { if ( ! $hook ) {

View File

@ -224,6 +224,17 @@ class GeneratePress_Hero {
$options['padding_bottom_unit_mobile'] = $options['padding_bottom_unit_mobile'] ? $options['padding_bottom_unit_mobile'] : 'px'; $options['padding_bottom_unit_mobile'] = $options['padding_bottom_unit_mobile'] ? $options['padding_bottom_unit_mobile'] : 'px';
$options['padding_left_unit_mobile'] = $options['padding_left_unit_mobile'] ? $options['padding_left_unit_mobile'] : 'px'; $options['padding_left_unit_mobile'] = $options['padding_left_unit_mobile'] ? $options['padding_left_unit_mobile'] : 'px';
$padding_inside = false;
$using_flexbox = false;
if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
$using_flexbox = true;
if ( function_exists( 'generate_get_option' ) && 'text' === generate_get_option( 'container_alignment' ) ) {
$padding_inside = true;
}
}
$css->set_selector( '.page-hero' ); $css->set_selector( '.page-hero' );
if ( $options['background_color'] ) { if ( $options['background_color'] ) {
@ -269,7 +280,9 @@ class GeneratePress_Hero {
$css->add_property( 'text-align', esc_html( $options['horizontal_alignment'] ) ); $css->add_property( 'text-align', esc_html( $options['horizontal_alignment'] ) );
} }
$css->add_property( 'box-sizing', 'border-box' ); if ( ! $using_flexbox ) {
$css->add_property( 'box-sizing', 'border-box' );
}
if ( $options['site_header_merge'] && $options['full_screen'] ) { if ( $options['site_header_merge'] && $options['full_screen'] ) {
$css->add_property( 'min-height', '100vh' ); $css->add_property( 'min-height', '100vh' );
@ -299,6 +312,32 @@ class GeneratePress_Hero {
} }
} }
if ( $padding_inside && function_exists( 'generate_get_option' ) ) {
$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
)
);
}
$css->set_selector( '.page-hero h1, .page-hero h2, .page-hero h3, .page-hero h4, .page-hero h5, .page-hero h6' ); $css->set_selector( '.page-hero h1, .page-hero h2, .page-hero h3, .page-hero h4, .page-hero h5, .page-hero h6' );
if ( $options['text_color'] ) { if ( $options['text_color'] ) {
$css->add_property( 'color', esc_attr( $options['text_color'] ) ); $css->add_property( 'color', esc_attr( $options['text_color'] ) );
@ -378,13 +417,23 @@ class GeneratePress_Hero {
$navigation_background_hover = $options['navigation_background_color_hover'] ? $options['navigation_background_color_hover'] : 'transparent'; $navigation_background_hover = $options['navigation_background_color_hover'] ? $options['navigation_background_color_hover'] : 'transparent';
$navigation_background_current = $options['navigation_background_color_current'] ? $options['navigation_background_color_current'] : 'transparent'; $navigation_background_current = $options['navigation_background_color_current'] ? $options['navigation_background_color_current'] : 'transparent';
$css->set_selector( '.header-wrap #site-navigation:not(.toggled), .header-wrap #mobile-header:not(.toggled):not(.navigation-stick)' ); $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->add_property( 'background', $navigation_background );
$css->set_selector( '.header-wrap #site-navigation:not(.toggled) .main-nav > ul > li > a, .header-wrap #mobile-header:not(.toggled):not(.navigation-stick) .main-nav > ul > li > a, .header-wrap .main-navigation:not(.toggled):not(.navigation-stick) .menu-toggle, .header-wrap .main-navigation:not(.toggled):not(.navigation-stick) .menu-toggle:hover, .main-navigation:not(.toggled):not(.navigation-stick) .mobile-bar-items a, .main-navigation:not(.toggled):not(.navigation-stick) .mobile-bar-items a:hover, .main-navigation:not(.toggled):not(.navigation-stick) .mobile-bar-items a:focus' ); if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
$css->set_selector( '.header-wrap #site-navigation:not(.toggled) .main-nav > ul > li > a, .header-wrap #mobile-header:not(.toggled):not(.navigation-stick) .main-nav > ul > li > a, .header-wrap .main-navigation:not(.toggled):not(.navigation-stick) .menu-toggle, .header-wrap .main-navigation:not(.toggled):not(.navigation-stick) .menu-toggle:hover, .main-navigation:not(.toggled):not(.navigation-stick) .menu-bar-item:not(.close-search) > a' );
} else {
$css->set_selector( '.header-wrap #site-navigation:not(.toggled) .main-nav > ul > li > a, .header-wrap #mobile-header:not(.toggled):not(.navigation-stick) .main-nav > ul > li > a, .header-wrap .main-navigation:not(.toggled):not(.navigation-stick) .menu-toggle, .header-wrap .main-navigation:not(.toggled):not(.navigation-stick) .menu-toggle:hover, .main-navigation:not(.toggled):not(.navigation-stick) .mobile-bar-items a, .main-navigation:not(.toggled):not(.navigation-stick) .mobile-bar-items a:hover, .main-navigation:not(.toggled):not(.navigation-stick) .mobile-bar-items a:focus' );
}
$css->add_property( 'color', esc_attr( $options['navigation_text_color'] ) ); $css->add_property( 'color', esc_attr( $options['navigation_text_color'] ) );
$css->set_selector( '.header-wrap #site-navigation:not(.toggled) .main-nav > ul > li:hover > a, .header-wrap #site-navigation:not(.toggled) .main-nav > ul > li:focus > a, .header-wrap #site-navigation:not(.toggled) .main-nav > ul > li.sfHover > a, .header-wrap #mobile-header:not(.toggled) .main-nav > ul > li:hover > a' ); if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
$css->set_selector( '.header-wrap #site-navigation:not(.toggled) .main-nav > ul > li:hover > a, .header-wrap #site-navigation:not(.toggled) .main-nav > ul > li:focus > a, .header-wrap #site-navigation:not(.toggled) .main-nav > ul > li.sfHover > a, .header-wrap #mobile-header:not(.toggled) .main-nav > ul > li:hover > a, .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' );
} else {
$css->set_selector( '.header-wrap #site-navigation:not(.toggled) .main-nav > ul > li:hover > a, .header-wrap #site-navigation:not(.toggled) .main-nav > ul > li:focus > a, .header-wrap #site-navigation:not(.toggled) .main-nav > ul > li.sfHover > a, .header-wrap #mobile-header:not(.toggled) .main-nav > ul > li:hover > a' );
}
$css->add_property( 'background', $navigation_background_hover ); $css->add_property( 'background', $navigation_background_hover );
if ( '' !== $options['navigation_text_color_hover'] ) { if ( '' !== $options['navigation_text_color_hover'] ) {
@ -666,7 +715,7 @@ class GeneratePress_Hero {
$attr = apply_filters( $attr = apply_filters(
'generate_page_hero_logo_attributes', 'generate_page_hero_logo_attributes',
array( array(
'class' => 'header-image', 'class' => 'header-image is-logo-image',
'alt' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ), 'alt' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
'src' => $logo_url, 'src' => $logo_url,
'title' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ), 'title' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
@ -722,7 +771,7 @@ class GeneratePress_Hero {
printf( printf(
'<div class="site-logo sticky-logo navigation-logo page-hero-navigation-logo"> '<div class="site-logo sticky-logo navigation-logo page-hero-navigation-logo">
<a href="%1$s" title="%2$s" rel="home"> <a href="%1$s" title="%2$s" rel="home">
<img class="header-image" src="%3$s" alt="%4$s" /> <img class="header-image is-logo-image" src="%3$s" alt="%4$s" />
</a> </a>
</div>', </div>',
esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ), esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ),
@ -748,7 +797,7 @@ class GeneratePress_Hero {
printf( printf(
'<div class="site-logo mobile-header-logo page-hero-mobile-logo"> '<div class="site-logo mobile-header-logo page-hero-mobile-logo">
<a href="%1$s" title="%2$s" rel="home"> <a href="%1$s" title="%2$s" rel="home">
<img class="header-image" src="%3$s" alt="%4$s" /> <img class="header-image is-logo-image" src="%3$s" alt="%4$s" />
</a> </a>
</div>', </div>',
esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ), esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ),
@ -817,7 +866,10 @@ class GeneratePress_Hero {
$options = self::get_options(); $options = self::get_options();
if ( strpos( $options['content'], '{{post_title}}' ) !== false ) { if ( strpos( $options['content'], '{{post_title}}' ) !== false ) {
add_filter( 'generate_show_title', '__return_false' ); if ( is_singular() ) {
add_filter( 'generate_show_title', '__return_false' );
}
remove_action( 'generate_archive_title', 'generate_archive_title' ); remove_action( 'generate_archive_title', 'generate_archive_title' );
add_filter( 'post_class', array( self::$hero, 'remove_hentry' ) ); add_filter( 'post_class', array( self::$hero, 'remove_hentry' ) );
} }

View File

@ -152,19 +152,7 @@ class GeneratePress_Elements_Metabox {
wp_enqueue_media(); wp_enqueue_media();
wp_enqueue_script( 'wp-color-picker' ); wp_enqueue_script( 'wp-color-picker' );
wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picker-alpha', plugin_dir_url( __FILE__ ) . 'assets/admin/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), GP_PREMIUM_VERSION, true ); wp_enqueue_script( 'wp-color-picker-alpha', GP_LIBRARY_DIRECTORY_URL . 'alpha-color-picker/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), '2.1.4', true );
wp_localize_script(
'wp-color-picker-alpha',
'wpColorPickerL10n',
array(
'defaultLabel' => __( 'Color value', 'gp-premium' ),
'pick' => __( 'Select Color', 'gp-premium' ),
'defaultString' => __( 'Default', 'gp-premium' ),
'defaultAriaLabel' => __( 'Select default color', 'gp-premium' ),
'clear' => __( 'Clear', 'gp-premium' ),
'clearAriaLabel' => __( 'Clear color', 'gp-premium' ),
)
);
if ( function_exists( 'wp_add_inline_script' ) && function_exists( 'generate_get_default_color_palettes' ) ) { if ( function_exists( 'wp_add_inline_script' ) && function_exists( 'generate_get_default_color_palettes' ) ) {
// Grab our palette array and turn it into JS. // Grab our palette array and turn it into JS.
@ -1256,7 +1244,7 @@ class GeneratePress_Elements_Metabox {
<input type="checkbox" name="_generate_disable_footer" id="_generate_disable_footer" value="true" <?php checked( get_post_meta( get_the_ID(), '_generate_disable_footer', true ), 'true' ); ?> /> <input type="checkbox" name="_generate_disable_footer" id="_generate_disable_footer" value="true" <?php checked( get_post_meta( get_the_ID(), '_generate_disable_footer', true ), 'true' ); ?> />
</td> </td>
</tr> </tr>
</body> </tbody>
</table> </table>
<table class="generate-elements-settings" data-type="layout" data-tab="content"> <table class="generate-elements-settings" data-type="layout" data-tab="content">
@ -2040,7 +2028,13 @@ class GeneratePress_Elements_Metabox {
public function get_terms() { public function get_terms() {
check_ajax_referer( 'generate-elements-location', 'nonce' ); check_ajax_referer( 'generate-elements-location', 'nonce' );
if ( ! current_user_can( 'manage_options' ) ) { $current_user_can = 'manage_options';
if ( apply_filters( 'generate_elements_metabox_ajax_allow_editors', false ) ) {
$current_user_can = 'edit_posts';
}
if ( ! current_user_can( $current_user_can ) ) {
return; return;
} }
@ -2063,7 +2057,13 @@ class GeneratePress_Elements_Metabox {
public function get_posts() { public function get_posts() {
check_ajax_referer( 'generate-elements-location', 'nonce' ); check_ajax_referer( 'generate-elements-location', 'nonce' );
if ( ! current_user_can( 'manage_options' ) ) { $current_user_can = 'manage_options';
if ( apply_filters( 'generate_elements_metabox_ajax_allow_editors', false ) ) {
$current_user_can = 'edit_posts';
}
if ( ! current_user_can( $current_user_can ) ) {
return; return;
} }
@ -2352,6 +2352,21 @@ class GeneratePress_Elements_Metabox {
); );
} }
if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
$hooks['navigation']['hooks'][] = 'generate_menu_bar_items';
}
if ( defined( 'GENERATE_VERSION' ) && version_compare( GENERATE_VERSION, '3.0.0-alpha.1', '>' ) ) {
$hooks['navigation']['hooks'][] = 'generate_before_navigation';
$hooks['navigation']['hooks'][] = 'generate_after_navigation';
$hooks['navigation']['hooks'][] = 'generate_after_mobile_menu_button';
$hooks['navigation']['hooks'][] = 'generate_inside_mobile_menu_control_wrapper';
$hooks['content']['hooks'][] = 'generate_after_loop';
$hooks['content']['hooks'][] = 'generate_before_do_template_part';
$hooks['content']['hooks'][] = 'generate_after_do_template_part';
}
return apply_filters( 'generate_hooks_list', $hooks ); return apply_filters( 'generate_hooks_list', $hooks );
} }

View File

@ -273,7 +273,13 @@ class GeneratePress_Elements_Post_Type {
if ( 'hook' === $block_type && $hook_location ) { if ( 'hook' === $block_type && $hook_location ) {
echo '<br />'; echo '<br />';
echo '<span class="hook-location">' . esc_html( $hook_location ) . '</span>';
if ( 'custom' === $hook_location ) {
$custom_hook = get_post_meta( $post_id, '_generate_custom_hook', true );
echo '<span class="hook-location">' . esc_html( $custom_hook ) . '</span>';
} else {
echo '<span class="hook-location">' . esc_html( $hook_location ) . '</span>';
}
} }
} }
} }
@ -287,7 +293,13 @@ class GeneratePress_Elements_Post_Type {
if ( $hook_location ) { if ( $hook_location ) {
echo '<br />'; echo '<br />';
echo '<span class="hook-location">' . esc_html( $hook_location ) . '</span>';
if ( 'custom' === $hook_location ) {
$custom_hook = get_post_meta( $post_id, '_generate_custom_hook', true );
echo '<span class="hook-location">' . esc_html( $custom_hook ) . '</span>';
} else {
echo '<span class="hook-location">' . esc_html( $hook_location ) . '</span>';
}
} }
} }

View File

@ -35,10 +35,18 @@ function generate_premium_do_elements() {
'post_status' => 'publish', 'post_status' => 'publish',
'numberposts' => 500, // phpcs:ignore 'numberposts' => 500, // phpcs:ignore
'fields' => 'ids', 'fields' => 'ids',
'order' => 'ASC',
'suppress_filters' => false, 'suppress_filters' => false,
); );
$custom_args = apply_filters(
'generate_elements_custom_args',
array(
'order' => 'ASC',
)
);
$args = array_merge( $args, $custom_args );
// Prevent Polylang from altering the query. // Prevent Polylang from altering the query.
if ( function_exists( 'pll_get_post_language' ) ) { if ( function_exists( 'pll_get_post_language' ) ) {
$args['lang'] = ''; $args['lang'] = '';

View File

@ -188,7 +188,13 @@ class GeneratePress_External_CSS_File {
*/ */
public function enqueue_dynamic_css() { public function enqueue_dynamic_css() {
if ( 'file' === $this->mode() ) { if ( 'file' === $this->mode() ) {
wp_enqueue_style( 'generatepress-dynamic', esc_url( $this->file( 'uri' ) ), array(), null ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion wp_enqueue_style( 'generatepress-dynamic', esc_url( $this->file( 'uri' ) ), array( 'generate-style' ), null ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
// Move the child theme after our dynamic stylesheet.
if ( is_child_theme() && wp_style_is( 'generate-child', 'enqueued' ) ) {
wp_dequeue_style( 'generate-child' );
wp_enqueue_style( 'generate-child' );
}
// Re-add no-cache CSS in GP < 3.0.0. // Re-add no-cache CSS in GP < 3.0.0.
if ( ! function_exists( 'generate_get_dynamic_css' ) && function_exists( 'generate_no_cache_dynamic_css' ) ) { if ( ! function_exists( 'generate_get_dynamic_css' ) && function_exists( 'generate_no_cache_dynamic_css' ) ) {

View File

@ -3,7 +3,7 @@
* Plugin Name: GP Premium * Plugin Name: GP Premium
* Plugin URI: https://generatepress.com * Plugin URI: https://generatepress.com
* Description: The entire collection of GeneratePress premium modules. * Description: The entire collection of GeneratePress premium modules.
* Version: 1.11.3 * Version: 1.12.2
* Author: Tom Usborne * Author: Tom Usborne
* Author URI: https://generatepress.com * Author URI: https://generatepress.com
* License: GNU General Public License v2 or later * License: GNU General Public License v2 or later
@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
define( 'GP_PREMIUM_VERSION', '1.11.3' ); define( 'GP_PREMIUM_VERSION', '1.12.2' );
define( 'GP_PREMIUM_DIR_PATH', plugin_dir_path( __FILE__ ) ); define( 'GP_PREMIUM_DIR_PATH', plugin_dir_path( __FILE__ ) );
define( 'GP_LIBRARY_DIRECTORY', plugin_dir_path( __FILE__ ) . 'library/' ); define( 'GP_LIBRARY_DIRECTORY', plugin_dir_path( __FILE__ ) . 'library/' );
define( 'GP_LIBRARY_DIRECTORY_URL', plugin_dir_url( __FILE__ ) . 'library/' ); define( 'GP_LIBRARY_DIRECTORY_URL', plugin_dir_url( __FILE__ ) . 'library/' );

View File

@ -620,6 +620,20 @@ function generate_sites_refresh_link() {
); );
} }
/**
* Delete our sites transient if the Refresh sites link is clicked.
*
* @since 1.6
* @deprecated 1.12.0
*/
function generate_sites_refresh_list() {
if ( ! isset( $_GET['refresh_sites_nonce'] ) || ! wp_verify_nonce( $_GET['refresh_sites_nonce'], 'refresh_sites' ) ) {
return;
}
delete_transient( 'generatepress_sites' );
}
if ( ! function_exists( 'generate_insert_import_export' ) ) { if ( ! function_exists( 'generate_insert_import_export' ) ) {
/** /**
* @deprecated 1.7 * @deprecated 1.7

File diff suppressed because it is too large Load Diff

View File

@ -20,16 +20,36 @@
_after = '<div class="wp-picker-holder" />', _after = '<div class="wp-picker-holder" />',
_wrap = '<div class="wp-picker-container" />', _wrap = '<div class="wp-picker-container" />',
_button = '<input type="button" class="button button-small" />', _button = '<input type="button" class="button button-small" />',
// Prevent CSS issues in < WordPress 4.9 _before = '<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>',
_deprecated = ( wpColorPickerL10n.current !== undefined ); _wrappingLabel = '<label></label>',
// Declare some global variables when is deprecated or not _wrappingLabelText = '<span class="screen-reader-text"></span>',
_deprecated = false;
if ( 'undefined' !== typeof wp.i18n ) {
var __ = wp.i18n.__,
_colorValue = __( 'Color value' ),
_selectColor = __( 'Select Color' ),
_defaultString = __( 'Default' ),
_defaultAriaLabel = __( 'Select default color' ),
_clearString = __( 'Clear' ),
_clearAriaLabel = __( 'Clear color' );
} else if ( typeof wpColorPickerL10n !== "undefined" ) {
// wpColorPickerL10n is defined in <= WordPress 5.4
// Prevent CSS issues in < WordPress 4.9. current can only be checked if we know wpColorPickerL10n is defined
_deprecated = ( typeof wpColorPickerL10n.current !== "undefined" );
if ( _deprecated ) { if ( _deprecated ) {
var _before = '<a tabindex="0" class="wp-color-result" />'; // Update _before if wpColorPickerL10n.current is defined (< WP 4.9)
} else { _before = '<a tabindex="0" class="wp-color-result" />';
var _before = '<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>',
_wrappingLabel = '<label></label>',
_wrappingLabelText = '<span class="screen-reader-text"></span>';
} }
var _colorValue = wpColorPickerL10n.defaultLabel,
_selectColor = wpColorPickerL10n.pick,
_defaultString = wpColorPickerL10n.defaultString,
_defaultAriaLabel = wpColorPickerL10n.defaultAriaLabel,
_clearString = wpColorPickerL10n.clear,
_clearAriaLabel = wpColorPickerL10n.clearAriaLabel;
}
/** /**
* Overwrite Color * Overwrite Color
* for enable support rbga * for enable support rbga
@ -96,7 +116,7 @@
self.toggler = $( _before ) self.toggler = $( _before )
.insertBefore( el ) .insertBefore( el )
.css( { backgroundColor : self.initialValue } ) .css( { backgroundColor : self.initialValue } )
.attr( 'title', wpColorPickerL10n.pick ) .attr( 'title', _selectColor )
.attr( 'data-current', wpColorPickerL10n.current ); .attr( 'data-current', wpColorPickerL10n.current );
self.pickerContainer = $( _after ).insertAfter( el ); self.pickerContainer = $( _after ).insertAfter( el );
self.button = $( _button ).addClass('hidden'); self.button = $( _button ).addClass('hidden');
@ -111,7 +131,7 @@
// Insert the default label text. // Insert the default label text.
self.wrappingLabelText = $( _wrappingLabelText ) self.wrappingLabelText = $( _wrappingLabelText )
.insertBefore( el ) .insertBefore( el )
.text( wpColorPickerL10n.defaultLabel ); .text( _colorValue );
} }
/* /*
@ -129,7 +149,7 @@
.insertBefore( self.wrappingLabel ) .insertBefore( self.wrappingLabel )
.css( { backgroundColor: self.initialValue } ); .css( { backgroundColor: self.initialValue } );
// Set the toggle button span element text. // Set the toggle button span element text.
self.toggler.find( '.wp-color-result-text' ).text( wpColorPickerL10n.pick ); self.toggler.find( '.wp-color-result-text' ).text( _selectColor );
// Set up the Iris container and insert it after the wrapping label. // Set up the Iris container and insert it after the wrapping label.
self.pickerContainer = $( _after ).insertAfter( self.wrappingLabel ); self.pickerContainer = $( _after ).insertAfter( self.wrappingLabel );
// Store a reference to the Clear/Default button. // Store a reference to the Clear/Default button.
@ -138,14 +158,14 @@
// Set up the Clear/Default button. // Set up the Clear/Default button.
if ( self.options.defaultColor ) { if ( self.options.defaultColor ) {
self.button.addClass( 'wp-picker-default' ).val( wpColorPickerL10n.defaultString ); self.button.addClass( 'wp-picker-default' ).val( _defaultString );
if ( ! _deprecated ) { if ( ! _deprecated ) {
self.button.attr( 'aria-label', wpColorPickerL10n.defaultAriaLabel ); self.button.attr( 'aria-label', _defaultAriaLabel );
} }
} else { } else {
self.button.addClass( 'wp-picker-clear' ).val( wpColorPickerL10n.clear ); self.button.addClass( 'wp-picker-clear' ).val( _clearString );
if ( ! _deprecated ) { if ( ! _deprecated ) {
self.button.attr( 'aria-label', wpColorPickerL10n.clearAriaLabel ); self.button.attr( 'aria-label', _clearAriaLabel );
} }
} }
@ -375,7 +395,7 @@
self.controls.square.css( { 'margin-right': '0' } ); self.controls.square.css( { 'margin-right': '0' } );
var emptyWidth = ( self.picker.width() - self.controls.square.width() - 20 ), var emptyWidth = ( self.picker.width() - self.controls.square.width() - 20 ),
stripsMargin = ( emptyWidth / 6 ), stripsMargin = ( emptyWidth / 6 ),
stripsWidth = ( ( emptyWidth / 2 ) - stripsMargin ); stripsWidth = ( ( emptyWidth / 2 ) - stripsMargin ) - 1;
$.each( [ 'aContainer', 'strip' ], function( k, v ) { $.each( [ 'aContainer', 'strip' ], function( k, v ) {
self.controls[v].width( stripsWidth ).css( { 'margin-left' : stripsMargin + 'px' } ); self.controls[v].width( stripsWidth ).css( { 'margin-left' : stripsMargin + 'px' } );

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ if ( ! class_exists( 'GeneratePress_Pro_CSS' ) ) :
* Modified by Tom Usborne for GeneratePress * Modified by Tom Usborne for GeneratePress
*/ */
class GeneratePress_Pro_CSS { class GeneratePress_Pro_CSS {
/** /**
* The css selector that you're currently adding rules to * The css selector that you're currently adding rules to
* *
@ -17,7 +17,7 @@ class GeneratePress_Pro_CSS {
* @var string * @var string
*/ */
protected $_selector = ''; protected $_selector = '';
/** /**
* Stores the final css output with all of its rules for the current selector. * Stores the final css output with all of its rules for the current selector.
* *
@ -25,7 +25,7 @@ class GeneratePress_Pro_CSS {
* @var string * @var string
*/ */
protected $_selector_output = ''; protected $_selector_output = '';
/** /**
* Stores all of the rules that will be added to the selector * Stores all of the rules that will be added to the selector
* *
@ -33,7 +33,7 @@ class GeneratePress_Pro_CSS {
* @var string * @var string
*/ */
protected $_css = ''; protected $_css = '';
/** /**
* The string that holds all of the css to output * The string that holds all of the css to output
* *
@ -41,14 +41,14 @@ class GeneratePress_Pro_CSS {
* @var string * @var string
*/ */
protected $_output = ''; protected $_output = '';
/** /**
* Stores media queries * Stores media queries
* *
* @var null * @var null
*/ */
protected $_media_query = null; protected $_media_query = null;
/** /**
* The string that holds all of the css to output inside of the media query * The string that holds all of the css to output inside of the media query
* *
@ -62,7 +62,7 @@ class GeneratePress_Pro_CSS {
* *
* @access public * @access public
* @since 1.0 * @since 1.0
* *
* @param string $selector - the css identifier of the html that you wish to target * @param string $selector - the css identifier of the html that you wish to target
* @return $this * @return $this
*/ */
@ -80,7 +80,7 @@ class GeneratePress_Pro_CSS {
* *
* @access public * @access public
* @since 1.0 * @since 1.0
* *
* @param string $property - the css property * @param string $property - the css property
* @param string $value - the value to be placed with the 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 $og_default - check to see if the value matches the default
@ -95,15 +95,15 @@ class GeneratePress_Pro_CSS {
$og_default = $og_default . $unit; $og_default = $og_default . $unit;
} }
} }
// If we don't have a value or our value is the same as our og default, bail // If we don't have a value or our value is the same as our og default, bail
if ( empty( $value ) || $og_default == $value ) if ( empty( $value ) || $og_default == $value )
return false; return false;
$this->_css .= $property . ':' . $value . ';'; $this->_css .= $property . ':' . $value . ';';
return $this; return $this;
} }
/** /**
* Sets a media query in the class * Sets a media query in the class
* *
@ -114,17 +114,17 @@ class GeneratePress_Pro_CSS {
public function start_media_query( $value ) { public function start_media_query( $value ) {
// Add the current rules to the output // Add the current rules to the output
$this->add_selector_rules_to_output(); $this->add_selector_rules_to_output();
// Add any previous media queries to the output // Add any previous media queries to the output
if ( ! empty( $this->_media_query ) ) { if ( ! empty( $this->_media_query ) ) {
$this->add_media_query_rules_to_output(); $this->add_media_query_rules_to_output();
} }
// Set the new media query // Set the new media query
$this->_media_query = $value; $this->_media_query = $value;
return $this; return $this;
} }
/** /**
* Stops using a media query. * Stops using a media query.
* *
@ -136,7 +136,7 @@ class GeneratePress_Pro_CSS {
public function stop_media_query() { public function stop_media_query() {
return $this->start_media_query( null ); return $this->start_media_query( null );
} }
/** /**
* Adds the current media query's rules to the class' output variable * Adds the current media query's rules to the class' output variable
* *
@ -146,13 +146,13 @@ class GeneratePress_Pro_CSS {
private function add_media_query_rules_to_output() { private function add_media_query_rules_to_output() {
if( !empty( $this->_media_query_output ) ) { if( !empty( $this->_media_query_output ) ) {
$this->_output .= sprintf( '@media %1$s{%2$s}', $this->_media_query, $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 // Reset the media query output string
$this->_media_query_output = ''; $this->_media_query_output = '';
} }
return $this; return $this;
} }
/** /**
* Adds the current selector rules to the output variable * Adds the current selector rules to the output variable
* *
@ -165,7 +165,7 @@ class GeneratePress_Pro_CSS {
if( !empty( $this->_css ) ) { if( !empty( $this->_css ) ) {
$this->_selector_output = $this->_selector; $this->_selector_output = $this->_selector;
$selector_output = sprintf( '%1$s{%2$s}', $this->_selector_output, $this->_css ); $selector_output = sprintf( '%1$s{%2$s}', $this->_selector_output, $this->_css );
// Add our CSS to the output // Add our CSS to the output
if ( ! empty( $this->_media_query ) ) { if ( ! empty( $this->_media_query ) ) {
$this->_media_query_output .= $selector_output; $this->_media_query_output .= $selector_output;
@ -186,7 +186,7 @@ class GeneratePress_Pro_CSS {
* *
* @access public * @access public
* @since 1.0 * @since 1.0
* *
* @return string * @return string
*/ */
public function css_output() public function css_output()
@ -199,4 +199,4 @@ class GeneratePress_Pro_CSS {
} }
} }
endif; endif;

View File

@ -85,7 +85,7 @@ function generate_premium_control_inline_scripts() {
$color_defaults = generate_get_color_defaults(); $color_defaults = generate_get_color_defaults();
$controls_a11y['navigationTextColor'] = $color_defaults['navigation_text_color']; $controls_a11y['navigationTextColor'] = $color_defaults['navigation_text_color'];
$controls_a11y['headerTextColor'] = $color_defaults['header_text_color']; $controls_a11y['siteTitleTextColor'] = $color_defaults['site_title_color'];
} }
if ( function_exists( 'generate_get_defaults' ) ) { if ( function_exists( 'generate_get_defaults' ) ) {

View File

@ -16,8 +16,8 @@
mobileHeader = api.instance( 'generate_menu_plus_settings[mobile_header]' ).get(), mobileHeader = api.instance( 'generate_menu_plus_settings[mobile_header]' ).get(),
navTextColorSetting = api.instance( 'generate_settings[navigation_text_color]' ), navTextColorSetting = api.instance( 'generate_settings[navigation_text_color]' ),
navTextColor = gpControls.navigationTextColor, navTextColor = gpControls.navigationTextColor,
headerTextColorSetting = api.instance( 'generate_settings[header_text_color]' ), siteTitleTextColorSetting = api.instance( 'generate_settings[site_title_color]' ),
headerTextColor = gpControls.headerTextColor; siteTitleTextColor = gpControls.siteTitleTextColor;
if ( siteTitleFontSizeSetting && ! siteTitleFontSizeSetting._dirty && 25 !== siteTitleFontSizeSetting.get() ) { if ( siteTitleFontSizeSetting && ! siteTitleFontSizeSetting._dirty && 25 !== siteTitleFontSizeSetting.get() ) {
siteTitleFontSize = siteTitleFontSizeSetting.get(); siteTitleFontSize = siteTitleFontSizeSetting.get();
@ -31,8 +31,8 @@
navTextColor = navTextColorSetting.get(); navTextColor = navTextColorSetting.get();
} }
if ( headerTextColorSetting && ! headerTextColorSetting._dirty ) { if ( siteTitleTextColorSetting && ! siteTitleTextColorSetting._dirty ) {
headerTextColor = headerTextColorSetting.get(); siteTitleTextColor = siteTitleTextColorSetting.get();
} }
if ( newval ) { if ( newval ) {
@ -57,7 +57,7 @@
} }
if ( api.instance( 'generate_settings[site_title_color]' ) ) { if ( api.instance( 'generate_settings[site_title_color]' ) ) {
api.instance( 'generate_settings[site_title_color]' ).set( headerTextColor ); api.instance( 'generate_settings[site_title_color]' ).set( siteTitleTextColor );
} }
if ( mobileSiteTitleFontSizeSetting && 'enable' !== mobileHeader ) { if ( mobileSiteTitleFontSizeSetting && 'enable' !== mobileHeader ) {
@ -68,8 +68,7 @@
var showRegularHeader, var showRegularHeader,
showRegularHeaderCallback, showRegularHeaderCallback,
showNavHeader, showNavHeader;
showNavHeaderCallback;
/** /**
* Determine whether we should display our header controls. * Determine whether we should display our header controls.
@ -112,21 +111,6 @@
value.bind( setActiveState ); value.bind( setActiveState );
}; };
/**
* Update a control's active state according to the navigation as header option.
*
* @param {wp.customize.Control} control
*/
showNavHeaderCallback = function( control ) {
var setActiveState = function() {
control.active.set( showNavHeader() );
};
control.active.validate = showNavHeader;
setActiveState();
value.bind( setActiveState );
};
api.control( 'generate_header_helper', showRegularHeaderCallback ); api.control( 'generate_header_helper', showRegularHeaderCallback );
api.control( 'generate_settings[header_layout_setting]', showRegularHeaderCallback ); api.control( 'generate_settings[header_layout_setting]', showRegularHeaderCallback );
api.control( 'generate_settings[header_inner_width]', showRegularHeaderCallback ); api.control( 'generate_settings[header_inner_width]', showRegularHeaderCallback );

View File

@ -4,46 +4,22 @@
align-items: center; align-items: center;
order: 0; order: 0;
margin-right: 10px; margin-right: 10px;
margin-left: 10px;
}
.rtl .navigation-branding,
.rtl .site-logo.mobile-header-logo {
margin-right: 10px;
margin-left: auto;
} }
.navigation-branding img, .navigation-branding img,
.site-logo.mobile-header-logo img { .site-logo.mobile-header-logo img {
position: relative; position: relative;
vertical-align: middle;
padding: 10px 0; padding: 10px 0;
display: block; display: block;
box-sizing: border-box;
transition: height .3s ease; transition: height .3s ease;
} }
.navigation-branding img { .navigation-branding > div + .main-title {
margin-right: 10px; margin-left: 10px;
} }
.navigation-branding .main-title { .navigation-branding .main-title {
transition: line-height .3s ease; transition: line-height .3s ease;
margin-right: 10px;
}
.rtl .navigation-branding .main-title {
margin-right: 0;
margin-left: 10px;
}
.mobile-header-navigation .navigation-branding .main-title {
margin-left: 10px;
}
.rtl .mobile-header-navigation .navigation-branding .main-title {
margin-left: 0;
margin-right: 10px;
} }
.navigation-branding .main-title a { .navigation-branding .main-title a {
@ -53,19 +29,6 @@
text-transform: unset; text-transform: unset;
} }
.main-navigation:not(.grid-container):not(.mobile-header-navigation) .inside-navigation.grid-container .navigation-branding {
margin-left: 0;
}
.rtl .main-navigation:not(.grid-container).nav-align-left:not(.mobile-header-navigation) .inside-navigation.grid-container .navigation-branding {
margin-left: auto;
margin-right: 0;
}
.rtl .main-navigation.nav-align-right:not(.mobile-header-navigation) .navigation-branding {
order: 10;
}
.main-navigation.mobile-header-navigation { .main-navigation.mobile-header-navigation {
display: none; display: none;
float: none; float: none;
@ -100,10 +63,6 @@
margin-right: auto; margin-right: auto;
} }
.nav-align-center .navigation-branding {
margin-right: 10px;
}
.main-navigation.has-branding:not([class*="nav-align-"]):not(.mobile-header-navigation) .inside-navigation, .main-navigation.has-branding:not([class*="nav-align-"]):not(.mobile-header-navigation) .inside-navigation,
.main-navigation.has-sticky-branding.navigation-stick:not([class*="nav-align-"]):not(.mobile-header-navigation) .inside-navigation { .main-navigation.has-sticky-branding.navigation-stick:not([class*="nav-align-"]):not(.mobile-header-navigation) .inside-navigation {
justify-content: flex-start; justify-content: flex-start;
@ -113,3 +72,45 @@
.main-navigation.has-sticky-branding.navigation-stick:not([class*="nav-align-"]):not(.mobile-header-navigation) .menu-bar-items { .main-navigation.has-sticky-branding.navigation-stick:not([class*="nav-align-"]):not(.mobile-header-navigation) .menu-bar-items {
margin-left: auto; margin-left: auto;
} }
.nav-float-right .main-navigation.has-branding:not(.mobile-header-navigation) .menu-bar-items,
.nav-float-right .main-navigation.has-sticky-branding.navigation-stick:not(.mobile-header-navigation) .menu-bar-items {
margin-left: 0;
}
.mobile-header-navigation.has-menu-bar-items .mobile-header-logo {
margin-right: auto;
}
.rtl .navigation-branding > div + .main-title {
margin-right: 10px;
}
.rtl .main-navigation.nav-align-right:not(.mobile-header-navigation) .navigation-branding {
order: -10;
}
.rtl .nav-align-right .navigation-branding {
margin-right: 10px;
}
.rtl .navigation-branding,
.rtl .site-logo.mobile-header-logo {
margin-left: auto;
margin-right: 0;
}
.rtl .nav-align-center .navigation-branding,
.rtl .nav-align-center .site-logo.mobile-header-logo,
.rtl .nav-align-right .navigation-branding,
.rtl .nav-align-right .site-logo.mobile-header-logo {
margin-left: 10px;
}
.rtl .nav-align-right .menu-bar-items {
margin-right: auto;
}
.rtl .mobile-header-navigation.has-menu-bar-items .site-logo {
margin-left: auto;
}

View File

@ -1 +1 @@
.navigation-branding,.site-logo.mobile-header-logo{display:flex;align-items:center;order:0;margin-right:10px;margin-left:10px}.rtl .navigation-branding,.rtl .site-logo.mobile-header-logo{margin-right:10px;margin-left:auto}.navigation-branding img,.site-logo.mobile-header-logo img{position:relative;vertical-align:middle;padding:10px 0;display:block;box-sizing:border-box;transition:height .3s ease}.navigation-branding img{margin-right:10px}.navigation-branding .main-title{transition:line-height .3s ease;margin-right:10px}.rtl .navigation-branding .main-title{margin-right:0;margin-left:10px}.mobile-header-navigation .navigation-branding .main-title{margin-left:10px}.rtl .mobile-header-navigation .navigation-branding .main-title{margin-left:0;margin-right:10px}.navigation-branding .main-title a{font-family:inherit;font-size:inherit;font-weight:inherit;text-transform:unset}.main-navigation:not(.grid-container):not(.mobile-header-navigation) .inside-navigation.grid-container .navigation-branding{margin-left:0}.rtl .main-navigation:not(.grid-container).nav-align-left:not(.mobile-header-navigation) .inside-navigation.grid-container .navigation-branding{margin-left:auto;margin-right:0}.rtl .main-navigation.nav-align-right:not(.mobile-header-navigation) .navigation-branding{order:10}.main-navigation.mobile-header-navigation{display:none;float:none;margin-bottom:0}.mobile-header-navigation.is_stuck{box-shadow:0 2px 2px -2px rgba(0,0,0,.2)}.main-navigation .menu-toggle{flex-grow:1;width:auto}.main-navigation.has-branding .menu-toggle,.main-navigation.has-sticky-branding.navigation-stick .menu-toggle{flex-grow:0;padding-right:20px;order:2}.main-navigation:not(.slideout-navigation) .mobile-bar-items+.menu-toggle{text-align:left}.main-navigation.has-sticky-branding:not(.has-branding):not(.navigation-stick) .navigation-branding{display:none}.nav-align-right .navigation-branding{margin-right:auto}.nav-align-center .navigation-branding{margin-right:10px}.main-navigation.has-branding:not([class*=nav-align-]):not(.mobile-header-navigation) .inside-navigation,.main-navigation.has-sticky-branding.navigation-stick:not([class*=nav-align-]):not(.mobile-header-navigation) .inside-navigation{justify-content:flex-start}.main-navigation.has-branding:not([class*=nav-align-]):not(.mobile-header-navigation) .menu-bar-items,.main-navigation.has-sticky-branding.navigation-stick:not([class*=nav-align-]):not(.mobile-header-navigation) .menu-bar-items{margin-left:auto} .navigation-branding,.site-logo.mobile-header-logo{display:flex;align-items:center;order:0;margin-right:10px}.navigation-branding img,.site-logo.mobile-header-logo img{position:relative;padding:10px 0;display:block;transition:height .3s ease}.navigation-branding>div+.main-title{margin-left:10px}.navigation-branding .main-title{transition:line-height .3s ease}.navigation-branding .main-title a{font-family:inherit;font-size:inherit;font-weight:inherit;text-transform:unset}.main-navigation.mobile-header-navigation{display:none;float:none;margin-bottom:0}.mobile-header-navigation.is_stuck{box-shadow:0 2px 2px -2px rgba(0,0,0,.2)}.main-navigation .menu-toggle{flex-grow:1;width:auto}.main-navigation.has-branding .menu-toggle,.main-navigation.has-sticky-branding.navigation-stick .menu-toggle{flex-grow:0;padding-right:20px;order:2}.main-navigation:not(.slideout-navigation) .mobile-bar-items+.menu-toggle{text-align:left}.main-navigation.has-sticky-branding:not(.has-branding):not(.navigation-stick) .navigation-branding{display:none}.nav-align-right .navigation-branding{margin-right:auto}.main-navigation.has-branding:not([class*=nav-align-]):not(.mobile-header-navigation) .inside-navigation,.main-navigation.has-sticky-branding.navigation-stick:not([class*=nav-align-]):not(.mobile-header-navigation) .inside-navigation{justify-content:flex-start}.main-navigation.has-branding:not([class*=nav-align-]):not(.mobile-header-navigation) .menu-bar-items,.main-navigation.has-sticky-branding.navigation-stick:not([class*=nav-align-]):not(.mobile-header-navigation) .menu-bar-items{margin-left:auto}.nav-float-right .main-navigation.has-branding:not(.mobile-header-navigation) .menu-bar-items,.nav-float-right .main-navigation.has-sticky-branding.navigation-stick:not(.mobile-header-navigation) .menu-bar-items{margin-left:0}.mobile-header-navigation.has-menu-bar-items .mobile-header-logo{margin-right:auto}.rtl .navigation-branding>div+.main-title{margin-right:10px}.rtl .main-navigation.nav-align-right:not(.mobile-header-navigation) .navigation-branding{order:-10}.rtl .nav-align-right .navigation-branding{margin-right:10px}.rtl .navigation-branding,.rtl .site-logo.mobile-header-logo{margin-left:auto;margin-right:0}.rtl .nav-align-center .navigation-branding,.rtl .nav-align-center .site-logo.mobile-header-logo,.rtl .nav-align-right .navigation-branding,.rtl .nav-align-right .site-logo.mobile-header-logo{margin-left:10px}.rtl .nav-align-right .menu-bar-items{margin-right:auto}.rtl .mobile-header-navigation.has-menu-bar-items .site-logo{margin-left:auto}

View File

@ -127,6 +127,11 @@
color: #fff; color: #fff;
font-size: 30px; font-size: 30px;
border: 0; border: 0;
opacity: 0;
}
.slide-opened .slideout-overlay button.slideout-exit {
opacity: 1;
} }
button.slideout-exit:hover { button.slideout-exit:hover {
@ -343,6 +348,11 @@ button.slideout-exit:hover {
display: none !important; display: none !important;
} }
.slideout-mobile .has-inline-mobile-toggle #site-navigation.toggled,
.slideout-both .has-inline-mobile-toggle #site-navigation.toggled {
margin-top: 0;
}
.sf-menu > li.slideout-toggle { .sf-menu > li.slideout-toggle {
float: right; float: right;
} }

File diff suppressed because one or more lines are too long

View File

@ -900,12 +900,46 @@ if ( ! function_exists( 'generate_menu_plus_inline_css' ) ) {
} }
if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) { if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
if ( 'true' === $generate_menu_plus_settings['sticky_menu'] || 'mobile' === $generate_menu_plus_settings['sticky_menu'] || 'enable' === $generate_menu_plus_settings['mobile_header_sticky'] ) { if ( 'true' === $generate_menu_plus_settings['sticky_menu'] || 'desktop' === $generate_menu_plus_settings['sticky_menu'] || 'mobile' === $generate_menu_plus_settings['sticky_menu'] || 'enable' === $generate_menu_plus_settings['mobile_header_sticky'] ) {
$return .= '.sticky-enabled .gen-sidebar-nav.is_stuck .main-navigation {margin-bottom: 0px;}'; $return .= '.sticky-enabled .gen-sidebar-nav.is_stuck .main-navigation {margin-bottom: 0px;}';
$return .= '.sticky-enabled .gen-sidebar-nav.is_stuck {z-index: 500;}'; $return .= '.sticky-enabled .gen-sidebar-nav.is_stuck {z-index: 500;}';
$return .= '.sticky-enabled .main-navigation.is_stuck {box-shadow: 0 2px 2px -2px rgba(0, 0, 0, .2);}'; $return .= '.sticky-enabled .main-navigation.is_stuck {box-shadow: 0 2px 2px -2px rgba(0, 0, 0, .2);}';
$return .= '.navigation-stick:not(.gen-sidebar-nav) {left: 0;right: 0;width: 100% !important;}'; $return .= '.navigation-stick:not(.gen-sidebar-nav) {left: 0;right: 0;width: 100% !important;}';
$return .= '.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 {position: absolute;left: 0;right: 0;z-index: 999;}';
if ( function_exists( 'generate_get_option' ) && generate_get_option( 'smooth_scroll' ) ) {
$return .= '.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 {position: absolute;left: 0;right: 0;z-index: 999;}';
}
if ( function_exists( 'generate_has_inline_mobile_toggle' ) && generate_has_inline_mobile_toggle() && 'enable' !== $generate_menu_plus_settings['mobile_header'] ) {
$return .= '@media ' . generate_premium_get_media_query( 'mobile-menu' ) . '{#sticky-placeholder{height:0;overflow:hidden;}.has-inline-mobile-toggle #site-navigation.toggled{margin-top:0;}.has-inline-mobile-menu #site-navigation.toggled .main-nav > ul{top:1.5em;}}';
}
$return .= '.nav-float-right .navigation-stick {width: 100% !important;left: 0;}';
$return .= '.nav-float-right .navigation-stick .navigation-branding {margin-right: auto;}';
$return .= '.main-navigation.has-sticky-branding:not(.grid-container) .inside-navigation:not(.grid-container) .navigation-branding{margin-left: 10px;}';
if ( ! $generate_menu_plus_settings['navigation_as_header'] ) {
$header_left = 40;
$header_right = 40;
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'];
}
if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
if ( function_exists( 'generate_get_option' ) && 'text' === generate_get_option( 'container_alignment' ) ) {
$return .= '.main-navigation.navigation-stick.has-sticky-branding .inside-navigation.grid-container{padding-left:' . $header_left . 'px;padding-right:' . $header_right . 'px;}';
$return .= '@media ' . generate_premium_get_media_query( 'mobile' ) . '{.main-navigation.navigation-stick.has-sticky-branding .inside-navigation.grid-container{padding-left:0;padding-right:0;}}';
}
}
}
} }
} }
@ -961,6 +995,12 @@ if ( ! function_exists( 'generate_menu_plus_mobile_header' ) ) {
$classes[] = 'wc-menu-cart-activated'; $classes[] = 'wc-menu-cart-activated';
} }
if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
if ( function_exists( 'generate_has_menu_bar_items' ) && generate_has_menu_bar_items() ) {
$classes[] = 'has-menu-bar-items';
}
}
$classes = implode( ' ', $classes ); $classes = implode( ' ', $classes );
?> ?>
<nav id="mobile-header"<?php echo esc_attr( $hide_sticky ); ?> class="<?php echo esc_attr( $classes ); ?>" <?php echo $microdata; // phpcs:ignore -- No escaping needed. ?>> <nav id="mobile-header"<?php echo esc_attr( $hide_sticky ); ?> class="<?php echo esc_attr( $classes ); ?>" <?php echo $microdata; // phpcs:ignore -- No escaping needed. ?>>
@ -1401,7 +1441,7 @@ if ( ! function_exists( 'generate_menu_plus_sticky_logo' ) ) {
sprintf( sprintf(
'<div class="site-logo sticky-logo navigation-logo"> '<div class="site-logo sticky-logo navigation-logo">
<a href="%1$s" title="%2$s" rel="home"> <a href="%1$s" title="%2$s" rel="home">
<img src="%3$s" alt="%4$s" /> <img src="%3$s" alt="%4$s" class="is-logo-image" />
</a> </a>
</div>', </div>',
esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ), esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ),
@ -1433,7 +1473,7 @@ if ( ! function_exists( 'generate_menu_plus_mobile_header_logo' ) ) {
sprintf( sprintf(
'<div class="site-logo mobile-header-logo"> '<div class="site-logo mobile-header-logo">
<a href="%1$s" title="%2$s" rel="home"> <a href="%1$s" title="%2$s" rel="home">
<img src="%3$s" alt="%4$s" /> <img src="%3$s" alt="%4$s" class="is-logo-image" />
</a> </a>
</div>', </div>',
esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ), esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ),
@ -1585,6 +1625,14 @@ function generate_do_off_canvas_css() {
$css->set_selector( '.slide-opened nav.toggled .menu-toggle:before' ); $css->set_selector( '.slide-opened nav.toggled .menu-toggle:before' );
$css->add_property( 'display', 'none' ); $css->add_property( 'display', 'none' );
} }
if ( 'font' === generate_get_option( 'icons' ) ) {
$css->set_selector( '.slideout-navigation .dropdown-menu-toggle:before' );
$css->add_property( 'content', '"\f107"' );
$css->set_selector( '.slideout-navigation .sfHover > a .dropdown-menu-toggle:before' );
$css->add_property( 'content', '"\f106"' );
}
} }
} }
@ -1655,6 +1703,8 @@ function generate_do_nav_branding_css() {
$navigation_height = 60; $navigation_height = 60;
$mobile_navigation_height = ''; $mobile_navigation_height = '';
$content_left = 40;
$content_right = 40;
if ( function_exists( 'generate_spacing_get_defaults' ) ) { if ( function_exists( 'generate_spacing_get_defaults' ) ) {
$spacing_settings = wp_parse_args( $spacing_settings = wp_parse_args(
@ -1667,6 +1717,34 @@ function generate_do_nav_branding_css() {
if ( isset( $spacing_settings['mobile_menu_item_height'] ) ) { if ( isset( $spacing_settings['mobile_menu_item_height'] ) ) {
$mobile_navigation_height = $spacing_settings['mobile_menu_item_height']; $mobile_navigation_height = $spacing_settings['mobile_menu_item_height'];
} }
$content_left = $spacing_settings['content_left'];
$content_right = $spacing_settings['content_right'];
}
if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
if ( function_exists( 'generate_get_option' ) ) {
if ( 'text' === generate_get_option( 'container_alignment' ) ) {
$css->set_selector( '.main-navigation.has-branding .inside-navigation.grid-container, .main-navigation.has-branding.grid-container .inside-navigation:not(.grid-container)' );
$css->add_property( 'padding', generate_padding_css( 0, $content_right, 0, $content_left ) );
$css->set_selector( '.main-navigation.has-branding:not(.grid-container) .inside-navigation:not(.grid-container) .navigation-branding' );
if ( ! is_rtl() ) {
$css->add_property( 'margin-left', '10px' );
} else {
$css->add_property( 'margin-right', '10px' );
}
} else {
$css->set_selector( '.main-navigation.has-branding.grid-container .navigation-branding, .main-navigation.has-branding:not(.grid-container) .inside-navigation:not(.grid-container) .navigation-branding' );
if ( ! is_rtl() ) {
$css->add_property( 'margin-left', '10px' );
} else {
$css->add_property( 'margin-right', '10px' );
}
}
}
} }
if ( '' !== $menu_plus_settings['sticky_navigation_logo'] ) { if ( '' !== $menu_plus_settings['sticky_navigation_logo'] ) {
@ -1684,24 +1762,57 @@ function generate_do_nav_branding_css() {
$css->set_selector( '.navigation-branding .main-title' ); $css->set_selector( '.navigation-branding .main-title' );
$css->add_property( 'line-height', absint( $navigation_height ), false, 'px' ); $css->add_property( 'line-height', absint( $navigation_height ), false, 'px' );
$css->start_media_query( '(max-width: ' . ( $settings['container_width'] + 10 ) . 'px)' ); $do_nav_padding = true;
$css->set_selector( '#site-navigation .navigation-branding, #sticky-navigation .navigation-branding' );
$css->add_property( 'margin-left', '10px' );
if ( is_rtl() ) { if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
$css->set_selector( '#site-navigation .navigation-branding, #sticky-navigation .navigation-branding' ); if ( function_exists( 'generate_get_option' ) && 'text' === generate_get_option( 'container_alignment' ) ) {
$css->add_property( 'margin-left', 'auto' ); $do_nav_padding = false;
$css->add_property( 'margin-right', '10px' ); }
}
if ( $do_nav_padding ) {
$css->start_media_query( '(max-width: ' . ( $settings['container_width'] + 10 ) . 'px)' );
$css->set_selector( '#site-navigation .navigation-branding, #sticky-navigation .navigation-branding' );
$css->add_property( 'margin-left', '10px' );
if ( is_rtl() ) {
$css->set_selector( '#site-navigation .navigation-branding, #sticky-navigation .navigation-branding' );
$css->add_property( 'margin-left', 'auto' );
$css->add_property( 'margin-right', '10px' );
}
$css->stop_media_query();
} }
$css->stop_media_query();
$css->start_media_query( generate_premium_get_media_query( 'mobile-menu' ) ); $css->start_media_query( generate_premium_get_media_query( 'mobile-menu' ) );
if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) { if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
$css->set_selector( '.main-navigation.has-branding.nav-align-center' ); $css->set_selector( '.main-navigation.has-branding.nav-align-center .menu-bar-items, .main-navigation.has-sticky-branding.navigation-stick.nav-align-center .menu-bar-items' );
$css->add_property( 'justify-content', 'flex-start' ); $css->add_property( 'margin-left', 'auto' );
$css->set_selector( '.navigation-branding' ); $css->set_selector( '.navigation-branding' );
$css->add_property( 'margin-right', 'auto' ); $css->add_property( 'margin-right', 'auto' );
$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( '.rtl .navigation-branding' );
$css->add_property( 'margin-left', 'auto' );
$css->add_property( 'margin-right', '10px' );
$css->set_selector( '.rtl .navigation-branding .main-title, .rtl .mobile-header-navigation .site-logo' );
$css->add_property( 'margin-right', '10px' );
$css->add_property( 'margin-left', '0px' );
$css->set_selector( '.rtl .main-navigation.has-branding.nav-align-center .menu-bar-items, .rtl .main-navigation.has-sticky-branding.navigation-stick.nav-align-center .menu-bar-items' );
$css->add_property( 'margin-left', '0px' );
$css->add_property( 'margin-right', 'auto' );
}
if ( function_exists( 'generate_get_option' ) && 'text' === generate_get_option( 'container_alignment' ) ) {
$css->set_selector( '.main-navigation.has-branding .inside-navigation.grid-container' );
$css->add_property( 'padding', '0px' );
}
} else { } else {
$css->set_selector( '.main-navigation:not(.slideout-navigation) .main-nav' ); $css->set_selector( '.main-navigation:not(.slideout-navigation) .main-nav' );
$css->add_property( '-webkit-box-flex', '0' ); $css->add_property( '-webkit-box-flex', '0' );
@ -1865,7 +1976,7 @@ function generate_do_navigation_branding() {
$attr = apply_filters( $attr = apply_filters(
'generate_logo_attributes', 'generate_logo_attributes',
array( array(
'class' => 'header-image', 'class' => 'header-image is-logo-image',
'alt' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ), 'alt' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
'src' => $logo_url, 'src' => $logo_url,
'title' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ), 'title' => esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
@ -1918,7 +2029,7 @@ function generate_do_navigation_branding() {
sprintf( sprintf(
'<div class="sticky-navigation-logo"> '<div class="sticky-navigation-logo">
<a href="%1$s" title="%2$s" rel="home"> <a href="%1$s" title="%2$s" rel="home">
<img src="%3$s" alt="%2$s" /> <img src="%3$s" class="is-logo-image" alt="%2$s" />
</a> </a>
</div>', </div>',
esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ), esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ),

View File

@ -1,340 +0,0 @@
/**!
* wp-color-picker-alpha
*
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
* Only run in input and is defined data alpha in true
*
* Version: 1.2.2
* https://github.com/23r9i0/wp-color-picker-alpha
* Copyright (c) 2015 Sergio P.A. (23r9i0).
* Licensed under the GPLv2 license.
*/
( function( $ ) {
// Variable for some backgrounds ( grid )
var image = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==',
// html stuff for wpColorPicker copy of the original color-picker.js
_before = '<button type="button" class="button wp-color-result" aria-expanded="false" style="position:relative;"><span class="wp-color-result-text">' + gpSectionsColorPickerL10n.pick + '</span></button>',
_after = '<div class="wp-picker-holder" />',
_wrap = '<div class="wp-picker-container" />',
_button = '<input type="button" class="button button-small" />',
_wrappingLabel = '<label></label>',
_wrappingLabelText = '<span class="screen-reader-text"></span>';
/**
* Overwrite Color
* for enable support rbga
*/
Color.fn.toString = function() {
if ( this._alpha < 1 )
return this.toCSS( 'rgba', this._alpha ).replace( /\s+/g, '' );
var hex = parseInt( this._color, 10 ).toString( 16 );
if ( this.error )
return '';
if ( hex.length < 6 )
hex = ( '00000' + hex ).substr( -6 );
return '#' + hex;
};
/**
* Overwrite wpColorPicker
*/
$.widget( 'wp.wpColorPicker', $.wp.wpColorPicker, {
_create: function() {
// bail early for unsupported Iris.
if ( ! $.support.iris )
return;
var self = this,
el = self.element;
self.inputWrapper = el.closest( '.wp-picker-input-wrap' );
$.extend( self.options, el.data() );
// keep close bound so it can be attached to a body listener
self.close = $.proxy( self.close, self );
self.initialValue = el.val();
// Set up HTML structure, hide things
el.addClass( 'wp-color-picker' ).wrap( _wrap );
self.wrap = el.parent();
self.toggler = $( _before ).insertBefore( el ).css( { backgroundColor : self.initialValue } ).attr( 'title', gpSectionsColorPickerL10n.pick ).attr( 'data-current', gpSectionsColorPickerL10n.current );
self.pickerContainer = $( _after ).insertAfter( el );
self.button = $( _button );
if ( self.options.defaultColor ) {
self.button.addClass( 'wp-picker-default' ).val( gpSectionsColorPickerL10n.defaultString );
} else {
self.button.addClass( 'wp-picker-clear' ).val( gpSectionsColorPickerL10n.clear );
}
el.wrap( '<span class="wp-picker-input-wrap hidden" />' ).after( self.button );
el.iris( {
target : self.pickerContainer,
hide : self.options.hide,
width : self.options.width,
mode : self.options.mode,
palettes : self.options.palettes,
change : function( event, ui ) {
if ( self.options.alpha ) {
self.toggler.css( { 'background-image' : 'url(' + image + ')' } ).html( '<span class="wp-color-result-text" style="position:relative;z-index:1;">' + gpSectionsColorPickerL10n.pick + '</span><span />' );
self.toggler.find( 'span' ).last().css( {
'width' : '100%',
'height' : '100%',
'position' : 'absolute',
'top' : 0,
'left' : 0,
'border-top-left-radius' : '3px',
'border-bottom-left-radius' : '3px',
'background' : ui.color.toString()
} );
} else {
self.toggler.css( { backgroundColor : ui.color.toString() } );
}
// Check for a custom cb
if ( $.isFunction( self.options.change ) )
self.options.change.call( this, event, ui );
}
} );
el.val( self.initialValue );
self._addListeners();
if ( ! self.options.hide ) {
self.toggler.click();
}
},
_addListeners: function() {
var self = this;
// prevent any clicks inside this widget from leaking to the top and closing it
self.wrap.on( 'click.wpcolorpicker', function( event ) {
event.stopPropagation();
} );
self.toggler.on( 'click', function() {
if ( self.toggler.hasClass( 'wp-picker-open' ) ) {
self.close();
} else {
self.open();
}
});
self.element.on( 'change', function( event ) {
// Empty or Error = clear
if ( $( this ).val() === '' || self.element.hasClass( 'iris-error' ) ) {
if ( self.options.alpha ) {
self.toggler.removeAttr( 'style' );
self.toggler.find( 'span' ).css( 'backgroundColor', '' );
} else {
self.toggler.css( 'backgroundColor', '' );
}
// fire clear callback if we have one
if ( $.isFunction( self.options.clear ) )
self.options.clear.call( this, event );
}
} );
// open a keyboard-focused closed picker with space or enter
self.toggler.on( 'keyup', function( event ) {
if ( event.keyCode === 13 || event.keyCode === 32 ) {
event.preventDefault();
self.toggler.trigger( 'click' ).next().focus();
}
});
self.button.on( 'click', function( event ) {
if ( $( this ).hasClass( 'wp-picker-clear' ) ) {
self.element.val( '' );
if ( self.options.alpha ) {
self.toggler.removeAttr( 'style' );
self.toggler.find( 'span' ).css( 'backgroundColor', '' );
} else {
self.toggler.css( 'backgroundColor', '' );
}
if ( $.isFunction( self.options.clear ) )
self.options.clear.call( this, event );
} else if ( $( this ).hasClass( 'wp-picker-default' ) ) {
self.element.val( self.options.defaultColor ).change();
}
});
}
});
/**
* Overwrite iris
*/
$.widget( 'a8c.iris', $.a8c.iris, {
_create: function() {
this._super();
// Global option for check is mode rbga is enabled
this.options.alpha = this.element.data( 'alpha' ) || false;
// Is not input disabled
if ( ! this.element.is( ':input' ) )
this.options.alpha = false;
if ( typeof this.options.alpha !== 'undefined' && this.options.alpha ) {
var self = this,
el = self.element,
_html = '<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>',
aContainer = $( _html ).appendTo( self.picker.find( '.iris-picker-inner' ) ),
aSlider = aContainer.find( '.iris-slider-offset-alpha' ),
controls = {
aContainer : aContainer,
aSlider : aSlider
};
if ( typeof el.data( 'custom-width' ) !== 'undefined' ) {
self.options.customWidth = parseInt( el.data( 'custom-width' ) ) || 0;
} else {
self.options.customWidth = 100;
}
// Set default width for input reset
self.options.defaultWidth = el.width();
// Update width for input
if ( self._color._alpha < 1 || self._color.toString().indexOf('rgb') != -1 )
el.width( parseInt( self.options.defaultWidth + self.options.customWidth ) );
// Push new controls
$.each( controls, function( k, v ) {
self.controls[k] = v;
} );
// Change size strip and add margin for sliders
self.controls.square.css( { 'margin-right': '0' } );
var emptyWidth = ( self.picker.width() - self.controls.square.width() - 20 ),
stripsMargin = ( emptyWidth / 6 ),
stripsWidth = ( ( emptyWidth / 2 ) - stripsMargin );
$.each( [ 'aContainer', 'strip' ], function( k, v ) {
self.controls[v].width( stripsWidth ).css( { 'margin-left' : stripsMargin + 'px' } );
} );
// Add new slider
self._initControls();
// For updated widget
self._change();
}
},
_initControls: function() {
this._super();
if ( this.options.alpha ) {
var self = this,
controls = self.controls;
controls.aSlider.slider({
orientation : 'vertical',
min : 0,
max : 100,
step : 1,
value : parseInt( self._color._alpha * 100 ),
slide : function( event, ui ) {
// Update alpha value
self._color._alpha = parseFloat( ui.value / 100 );
self._change.apply( self, arguments );
}
});
}
},
_change: function() {
this._super();
var self = this,
el = self.element;
if ( this.options.alpha ) {
var controls = self.controls,
alpha = parseInt( self._color._alpha * 100 ),
color = self._color.toRgb(),
gradient = [
'rgb(' + color.r + ',' + color.g + ',' + color.b + ') 0%',
'rgba(' + color.r + ',' + color.g + ',' + color.b + ', 0) 100%'
],
defaultWidth = self.options.defaultWidth,
customWidth = self.options.customWidth,
target = self.picker.closest( '.wp-picker-container' ).find( '.wp-color-result' );
// Generate background slider alpha, only for CSS3 old browser fuck!! :)
controls.aContainer.css( { 'background' : 'linear-gradient(to bottom, ' + gradient.join( ', ' ) + '), url(' + image + ')' } );
if ( target.hasClass( 'wp-picker-open' ) ) {
// Update alpha value
controls.aSlider.slider( 'value', alpha );
/**
* Disabled change opacity in default slider Saturation ( only is alpha enabled )
* and change input width for view all value
*/
if ( self._color._alpha < 1 ) {
controls.strip.attr( 'style', controls.strip.attr( 'style' ).replace( /rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g, 'rgb($1$3$5)' ) );
el.width( parseInt( defaultWidth + customWidth ) );
} else {
el.width( defaultWidth );
}
}
}
var reset = el.data( 'reset-alpha' ) || false;
if ( reset ) {
self.picker.find( '.iris-palette-container' ).on( 'click.palette', '.iris-palette', function() {
self._color._alpha = 1;
self.active = 'external';
self._change();
} );
}
},
_addInputListeners: function( input ) {
var self = this,
debounceTimeout = 100,
callback = function( event ) {
var color = new Color( input.val() ),
val = input.val();
input.removeClass( 'iris-error' );
// we gave a bad color
if ( color.error ) {
// don't error on an empty input
if ( val !== '' )
input.addClass( 'iris-error' );
} else {
if ( color.toString() !== self._color.toString() ) {
// let's not do this on keyup for hex shortcodes
if ( ! ( event.type === 'keyup' && val.match( /^[0-9a-fA-F]{3}$/ ) ) )
self._setOption( 'color', color.toString() );
}
}
};
input.on( 'change', callback ).on( 'keyup', self._debounce( callback, debounceTimeout ) );
// If we initialized hidden, show on first focus. The rest is up to you.
if ( self.options.hide ) {
input.on( 'focus', function() {
self.show();
} );
}
}
} );
}( jQuery ) );
// Auto Call plugin is class is color-picker
jQuery( document ).ready( function( $ ) {
$( '.color-picker' ).wpColorPicker();
} );

View File

@ -83,20 +83,7 @@ if ( ! function_exists( 'generate_page_header_metabox_enqueue' ) ) {
wp_enqueue_media(); wp_enqueue_media();
wp_enqueue_script( 'wp-color-picker' ); wp_enqueue_script( 'wp-color-picker' );
wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picker-alpha', plugin_dir_url( __FILE__ ) . 'js/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), GENERATE_PAGE_HEADER_VERSION ); wp_enqueue_script( 'wp-color-picker-alpha', GP_LIBRARY_DIRECTORY_URL . 'alpha-color-picker/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), '2.1.4', true );
wp_localize_script(
'wp-color-picker-alpha',
'gpSectionsColorPickerL10n',
array(
'defaultLabel' => __( 'Color value', 'gp-premium' ),
'pick' => __( 'Select Color', 'gp-premium' ),
'defaultString' => __( 'Default', 'gp-premium' ),
'defaultAriaLabel' => __( 'Select default color', 'gp-premium' ),
'clear' => __( 'Clear', 'gp-premium' ),
'clearAriaLabel' => __( 'Clear color', 'gp-premium' ),
)
);
wp_enqueue_style( 'generate-page-header-metabox', plugin_dir_url( __FILE__ ) . 'css/metabox.css', array(), GENERATE_PAGE_HEADER_VERSION ); wp_enqueue_style( 'generate-page-header-metabox', plugin_dir_url( __FILE__ ) . 'css/metabox.css', array(), GENERATE_PAGE_HEADER_VERSION );
wp_enqueue_script( 'generate-lc-switch', plugin_dir_url( __FILE__ ) . 'js/lc_switch.js', array( 'jquery' ), GENERATE_PAGE_HEADER_VERSION, false ); wp_enqueue_script( 'generate-lc-switch', plugin_dir_url( __FILE__ ) . 'js/lc_switch.js', array( 'jquery' ), GENERATE_PAGE_HEADER_VERSION, false );

View File

@ -5,7 +5,7 @@ Tags: generatepress
Requires at least: 4.5 Requires at least: 4.5
Tested up to: 5.5 Tested up to: 5.5
Requires PHP: 5.6 Requires PHP: 5.6
Stable tag: 1.11.3 Stable tag: 1.12.2
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
@ -27,6 +27,64 @@ In most cases, #1 will work fine and is way easier.
== Changelog == == Changelog ==
= 1.12.2 =
* Blog: Load columns CSS when using filter to enable it anywhere
* Menu Plus: Fix sticky mobile header jump when using inline mobile toggle
* Menu Plus: Add margin to sticky nav branding when set to full width
* Menu Plus: Disable sticky nav container text align padding
* Menu Plus: Make mobile menu absolute only when smooth scroll is enabled
* Menu Plus: Improve nav as header/mobile header when using flexbox
* Menu Plus: Prevent off-canvas panel close button from flashing visible when closing
* Spacing: Fix custom nav search height
= 1.12.1 =
* Typography: Fix missing heading font size controls in the Customizer
= 1.12.0 =
* Blog: Fix column margin on mobile with some caching plugins
* Blog: Add post-load trigger to infinite scroll for better plugin compatibility
* Blog: Take generate_blog_columns filter into account when loading columns CSS
* Colors: Add search menu-bar-item color live preview to Customizer
* Elements: Fix broken custom hook field in Block Elements
* Elements: Integrate page hero with text container alignment in GP 3.0
* Elements: Better integrate Header Element colors with GP 3.0
* Elements: Only disable content title when {{post_title}} is present on single pages
* Elements: Fix </body> tag in metabox
* Elements: Add generate_elements_metabox_ajax_allow_editors filter
* Elements: Add new 3.0 hooks to hook selector
* Elements: Re-add generate_elements_custom_args filter
* Menu Plus: Better prepare navigation as header for GP 3.0
* Menu Plus: Better prepare Off-Canvas Panel for GP 3.0
* Menu Plus: Better prepare sticky navigation for GP 3.0
* Menu Plus: Add has-menu-bar-items class to mobile header if needed
* Menu Plus: Add is-logo-image class to all site logos
* Menu Plus: Fix mobile header alignment when it has menu bar items
* Secondary Nav: Better prepare sticky navigation for GP 3.0
* Secondary Nav: Fix hidden navigation widget in top bar when merged with secondary nav
* Sites: Improve the option-only import feature
* Sites: Improve the refresh sites button functionality
* Sites: Improve the undo site import functionality
* Sites: Fix Elementor site import issues
* Sites: Re-add Elementor sites to library
* Spacing: Better prepare Customizer live preview for GP 3.0
* Spacing: Fix blog column spacing Customizer live preview
* Spacing: Stop handling mobile header, widget and footer widget features added in GP 3.0
* Typography: Add mobile font size control for H3 (when using GP 3.0)
* Typography: Add mobile font size control for H4 (when using GP 3.0)
* Typography: Add mobile font size control for H5 (when using GP 3.0)
* Typography: Allow empty tablet and mobile site title font size values
* Typography: Make menu toggle CSS selector specific to primary navigation
* WooCommerce: Use CSS for secondary product image functionality instead of JS
* WooCommerce: Only load .js file if needed
* WooCommerce: Fix quantity box functionality when multiple quantity boxes exist on the page
* General: Improve alpha color picker script for better 5.5 compatibility
* General: Move child theme stylesheet after dynamic stylesheet if enabled
* General: Update gp-premium-de_DE.mo
* General: Update gp-premium-es_ES.mo
* General: Update gp-premium-fi.mo
* General: Update gp-premium-pt_PT.mo
* General: Update gp-premium-sv_SE.mo
= 1.11.3 = = 1.11.3 =
* Blog: Set widths to grid-sizer element * Blog: Set widths to grid-sizer element
* Elements: Fix legacy Page Header/Hooks buttons in the Elements dashboard * Elements: Fix legacy Page Header/Hooks buttons in the Elements dashboard

View File

@ -197,8 +197,8 @@
display: inline-block; display: inline-block;
} }
.secondary-nav-aligned-right .secondary-navigation ul, .secondary-nav-aligned-right .secondary-navigation ul.secondary-menu,
.secondary-nav-aligned-center .secondary-navigation ul { .secondary-nav-aligned-center .secondary-navigation ul.secondary-menu {
font-size: 0px; font-size: 0px;
} }

File diff suppressed because one or more lines are too long

View File

@ -862,8 +862,16 @@ if ( ! function_exists( 'generate_secondary_navigation_classes' ) ) {
$nav_layout = $generate_settings['secondary_nav_layout_setting']; $nav_layout = $generate_settings['secondary_nav_layout_setting'];
if ( 'secondary-contained-nav' === $nav_layout ) { if ( 'secondary-contained-nav' === $nav_layout ) {
$classes[] = 'grid-container'; if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
$classes[] = 'grid-parent'; $navigation_location = $generate_settings['secondary_nav_position_setting'];
if ( 'secondary-nav-float-right' !== $navigation_location && 'secondary-nav-float-left' !== $navigation_location ) {
$classes[] = 'grid-container';
}
} else {
$classes[] = 'grid-container';
$classes[] = 'grid-parent';
}
} }
if ( 'left' === $generate_settings['secondary_nav_dropdown_direction'] ) { if ( 'left' === $generate_settings['secondary_nav_dropdown_direction'] ) {
@ -963,6 +971,21 @@ if ( ! function_exists( 'generate_secondary_nav_css' ) ) {
$css->add_property( 'background-image', ! empty( $generate_settings['nav_image'] ) ? 'url(' . esc_url( $generate_settings['nav_image'] ) . ')' : '' ); $css->add_property( 'background-image', ! empty( $generate_settings['nav_image'] ) ? 'url(' . esc_url( $generate_settings['nav_image'] ) . ')' : '' );
$css->add_property( 'background-repeat', esc_attr( $generate_settings['nav_repeat'] ) ); $css->add_property( 'background-repeat', esc_attr( $generate_settings['nav_repeat'] ) );
if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
if ( function_exists( 'generate_spacing_get_defaults' ) && function_exists( 'generate_get_option' ) && 'text' === generate_get_option( 'container_alignment' ) ) {
$spacing_settings = wp_parse_args(
get_option( 'generate_spacing_settings', array() ),
generate_spacing_get_defaults()
);
$navigation_left_padding = absint( $spacing_settings['header_left'] ) - absint( $generate_settings['secondary_menu_item'] );
$navigation_right_padding = absint( $spacing_settings['header_right'] ) - absint( $generate_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 ( 'secondary-nav-above-header' === $generate_settings['secondary_nav_position_setting'] && has_nav_menu( 'secondary' ) && is_active_sidebar( 'top-bar' ) ) { if ( 'secondary-nav-above-header' === $generate_settings['secondary_nav_position_setting'] && has_nav_menu( 'secondary' ) && is_active_sidebar( 'top-bar' ) ) {
$css->set_selector( '.secondary-navigation .top-bar' ); $css->set_selector( '.secondary-navigation .top-bar' );
$css->add_property( 'color', esc_attr( $generate_settings['navigation_text_color'] ) ); $css->add_property( 'color', esc_attr( $generate_settings['navigation_text_color'] ) );

View File

@ -4,6 +4,8 @@
*/ */
wp.customize( 'generate_secondary_nav_settings[secondary_nav_layout_setting]', function( value ) { wp.customize( 'generate_secondary_nav_settings[secondary_nav_layout_setting]', function( value ) {
value.bind( function( newval ) { value.bind( function( newval ) {
var navLocation = wp.customize.value('generate_secondary_nav_settings[secondary_nav_position_setting]')();
if ( 'secondary-fluid-nav' == newval ) { if ( 'secondary-fluid-nav' == newval ) {
$( '.secondary-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' ); $( '.secondary-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
if ( 'full-width' !== wp.customize.value('generate_secondary_nav_settings[secondary_nav_inner_width]')() ) { if ( 'full-width' !== wp.customize.value('generate_secondary_nav_settings[secondary_nav_inner_width]')() ) {
@ -11,6 +13,10 @@
} }
} }
if ( 'secondary-contained-nav' == newval ) { if ( 'secondary-contained-nav' == newval ) {
if ( generateSecondaryNav.isFlex && ( 'secondary-nav-float-right' === navLocation || 'secondary-nav-float-left' === navLocation ) ) {
return;
}
jQuery( '.secondary-navigation' ).addClass( 'grid-container' ).addClass( 'grid-parent' ); jQuery( '.secondary-navigation' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
jQuery( '.secondary-navigation .inside-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' ); jQuery( '.secondary-navigation .inside-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
} }

View File

@ -1,340 +0,0 @@
/**!
* wp-color-picker-alpha
*
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
* Only run in input and is defined data alpha in true
*
* Version: 1.2.2
* https://github.com/23r9i0/wp-color-picker-alpha
* Copyright (c) 2015 Sergio P.A. (23r9i0).
* Licensed under the GPLv2 license.
*/
( function( $ ) {
// Variable for some backgrounds ( grid )
var image = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==',
// html stuff for wpColorPicker copy of the original color-picker.js
_before = '<button type="button" class="button wp-color-result" aria-expanded="false" style="position:relative;"><span class="wp-color-result-text">' + gpSectionsColorPickerL10n.pick + '</span></button>',
_after = '<div class="wp-picker-holder" />',
_wrap = '<div class="wp-picker-container" />',
_button = '<input type="button" class="button button-small" />',
_wrappingLabel = '<label></label>',
_wrappingLabelText = '<span class="screen-reader-text"></span>';
/**
* Overwrite Color
* for enable support rbga
*/
Color.fn.toString = function() {
if ( this._alpha < 1 )
return this.toCSS( 'rgba', this._alpha ).replace( /\s+/g, '' );
var hex = parseInt( this._color, 10 ).toString( 16 );
if ( this.error )
return '';
if ( hex.length < 6 )
hex = ( '00000' + hex ).substr( -6 );
return '#' + hex;
};
/**
* Overwrite wpColorPicker
*/
$.widget( 'wp.wpColorPicker', $.wp.wpColorPicker, {
_create: function() {
// bail early for unsupported Iris.
if ( ! $.support.iris )
return;
var self = this,
el = self.element;
self.inputWrapper = el.closest( '.wp-picker-input-wrap' );
$.extend( self.options, el.data() );
// keep close bound so it can be attached to a body listener
self.close = $.proxy( self.close, self );
self.initialValue = el.val();
// Set up HTML structure, hide things
el.addClass( 'wp-color-picker' ).wrap( _wrap );
self.wrap = el.parent();
self.toggler = $( _before ).insertBefore( el ).css( { backgroundColor : self.initialValue } ).attr( 'title', gpSectionsColorPickerL10n.pick ).attr( 'data-current', gpSectionsColorPickerL10n.current );
self.pickerContainer = $( _after ).insertAfter( el );
self.button = $( _button );
if ( self.options.defaultColor ) {
self.button.addClass( 'wp-picker-default' ).val( gpSectionsColorPickerL10n.defaultString );
} else {
self.button.addClass( 'wp-picker-clear' ).val( gpSectionsColorPickerL10n.clear );
}
el.wrap( '<span class="wp-picker-input-wrap hidden" />' ).after( self.button );
el.iris( {
target : self.pickerContainer,
hide : self.options.hide,
width : self.options.width,
mode : self.options.mode,
palettes : self.options.palettes,
change : function( event, ui ) {
if ( self.options.alpha ) {
self.toggler.css( { 'background-image' : 'url(' + image + ')' } ).html( '<span class="wp-color-result-text" style="position:relative;z-index:1;">' + gpSectionsColorPickerL10n.pick + '</span><span />' );
self.toggler.find( 'span' ).last().css( {
'width' : '100%',
'height' : '100%',
'position' : 'absolute',
'top' : 0,
'left' : 0,
'border-top-left-radius' : '3px',
'border-bottom-left-radius' : '3px',
'background' : ui.color.toString()
} );
} else {
self.toggler.css( { backgroundColor : ui.color.toString() } );
}
// Check for a custom cb
if ( $.isFunction( self.options.change ) )
self.options.change.call( this, event, ui );
}
} );
el.val( self.initialValue );
self._addListeners();
if ( ! self.options.hide ) {
self.toggler.click();
}
},
_addListeners: function() {
var self = this;
// prevent any clicks inside this widget from leaking to the top and closing it
self.wrap.on( 'click.wpcolorpicker', function( event ) {
event.stopPropagation();
} );
self.toggler.on( 'click', function() {
if ( self.toggler.hasClass( 'wp-picker-open' ) ) {
self.close();
} else {
self.open();
}
});
self.element.on( 'change', function( event ) {
// Empty or Error = clear
if ( $( this ).val() === '' || self.element.hasClass( 'iris-error' ) ) {
if ( self.options.alpha ) {
self.toggler.removeAttr( 'style' );
self.toggler.find( 'span' ).css( 'backgroundColor', '' );
} else {
self.toggler.css( 'backgroundColor', '' );
}
// fire clear callback if we have one
if ( $.isFunction( self.options.clear ) )
self.options.clear.call( this, event );
}
} );
// open a keyboard-focused closed picker with space or enter
self.toggler.on( 'keyup', function( event ) {
if ( event.keyCode === 13 || event.keyCode === 32 ) {
event.preventDefault();
self.toggler.trigger( 'click' ).next().focus();
}
});
self.button.on( 'click', function( event ) {
if ( $( this ).hasClass( 'wp-picker-clear' ) ) {
self.element.val( '' );
if ( self.options.alpha ) {
self.toggler.removeAttr( 'style' );
self.toggler.find( 'span' ).css( 'backgroundColor', '' );
} else {
self.toggler.css( 'backgroundColor', '' );
}
if ( $.isFunction( self.options.clear ) )
self.options.clear.call( this, event );
} else if ( $( this ).hasClass( 'wp-picker-default' ) ) {
self.element.val( self.options.defaultColor ).change();
}
});
}
});
/**
* Overwrite iris
*/
$.widget( 'a8c.iris', $.a8c.iris, {
_create: function() {
this._super();
// Global option for check is mode rbga is enabled
this.options.alpha = this.element.data( 'alpha' ) || false;
// Is not input disabled
if ( ! this.element.is( ':input' ) )
this.options.alpha = false;
if ( typeof this.options.alpha !== 'undefined' && this.options.alpha ) {
var self = this,
el = self.element,
_html = '<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>',
aContainer = $( _html ).appendTo( self.picker.find( '.iris-picker-inner' ) ),
aSlider = aContainer.find( '.iris-slider-offset-alpha' ),
controls = {
aContainer : aContainer,
aSlider : aSlider
};
if ( typeof el.data( 'custom-width' ) !== 'undefined' ) {
self.options.customWidth = parseInt( el.data( 'custom-width' ) ) || 0;
} else {
self.options.customWidth = 100;
}
// Set default width for input reset
self.options.defaultWidth = el.width();
// Update width for input
if ( self._color._alpha < 1 || self._color.toString().indexOf('rgb') != -1 )
el.width( parseInt( self.options.defaultWidth + self.options.customWidth ) );
// Push new controls
$.each( controls, function( k, v ) {
self.controls[k] = v;
} );
// Change size strip and add margin for sliders
self.controls.square.css( { 'margin-right': '0' } );
var emptyWidth = ( self.picker.width() - self.controls.square.width() - 20 ),
stripsMargin = ( emptyWidth / 6 ),
stripsWidth = ( ( emptyWidth / 2 ) - stripsMargin );
$.each( [ 'aContainer', 'strip' ], function( k, v ) {
self.controls[v].width( stripsWidth ).css( { 'margin-left' : stripsMargin + 'px' } );
} );
// Add new slider
self._initControls();
// For updated widget
self._change();
}
},
_initControls: function() {
this._super();
if ( this.options.alpha ) {
var self = this,
controls = self.controls;
controls.aSlider.slider({
orientation : 'vertical',
min : 0,
max : 100,
step : 1,
value : parseInt( self._color._alpha * 100 ),
slide : function( event, ui ) {
// Update alpha value
self._color._alpha = parseFloat( ui.value / 100 );
self._change.apply( self, arguments );
}
});
}
},
_change: function() {
this._super();
var self = this,
el = self.element;
if ( this.options.alpha ) {
var controls = self.controls,
alpha = parseInt( self._color._alpha * 100 ),
color = self._color.toRgb(),
gradient = [
'rgb(' + color.r + ',' + color.g + ',' + color.b + ') 0%',
'rgba(' + color.r + ',' + color.g + ',' + color.b + ', 0) 100%'
],
defaultWidth = self.options.defaultWidth,
customWidth = self.options.customWidth,
target = self.picker.closest( '.wp-picker-container' ).find( '.wp-color-result' );
// Generate background slider alpha, only for CSS3 old browser fuck!! :)
controls.aContainer.css( { 'background' : 'linear-gradient(to bottom, ' + gradient.join( ', ' ) + '), url(' + image + ')' } );
if ( target.hasClass( 'wp-picker-open' ) ) {
// Update alpha value
controls.aSlider.slider( 'value', alpha );
/**
* Disabled change opacity in default slider Saturation ( only is alpha enabled )
* and change input width for view all value
*/
if ( self._color._alpha < 1 ) {
controls.strip.attr( 'style', controls.strip.attr( 'style' ).replace( /rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g, 'rgb($1$3$5)' ) );
el.width( parseInt( defaultWidth + customWidth ) );
} else {
el.width( defaultWidth );
}
}
}
var reset = el.data( 'reset-alpha' ) || false;
if ( reset ) {
self.picker.find( '.iris-palette-container' ).on( 'click.palette', '.iris-palette', function() {
self._color._alpha = 1;
self.active = 'external';
self._change();
} );
}
},
_addInputListeners: function( input ) {
var self = this,
debounceTimeout = 100,
callback = function( event ) {
var color = new Color( input.val() ),
val = input.val();
input.removeClass( 'iris-error' );
// we gave a bad color
if ( color.error ) {
// don't error on an empty input
if ( val !== '' )
input.addClass( 'iris-error' );
} else {
if ( color.toString() !== self._color.toString() ) {
// let's not do this on keyup for hex shortcodes
if ( ! ( event.type === 'keyup' && val.match( /^[0-9a-fA-F]{3}$/ ) ) )
self._setOption( 'color', color.toString() );
}
}
};
input.on( 'change', callback ).on( 'keyup', self._debounce( callback, debounceTimeout ) );
// If we initialized hidden, show on first focus. The rest is up to you.
if ( self.options.hide ) {
input.on( 'focus', function() {
self.show();
} );
}
}
} );
}( jQuery ) );
// Auto Call plugin is class is color-picker
jQuery( document ).ready( function( $ ) {
$( '.color-picker' ).wpColorPicker();
} );

View File

@ -172,20 +172,7 @@ if ( ! function_exists( 'generate_sections_metabox_scripts' ) ) {
wp_enqueue_script( 'media-upload' ); wp_enqueue_script( 'media-upload' );
wp_enqueue_script( 'wp-color-picker' ); wp_enqueue_script( 'wp-color-picker' );
wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picker-alpha', plugin_dir_url( __FILE__ ) . 'js/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), GENERATE_SECTIONS_VERSION ); wp_enqueue_script( 'wp-color-picker-alpha', GP_LIBRARY_DIRECTORY_URL . 'alpha-color-picker/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), '2.1.4', true );
wp_localize_script(
'wp-color-picker-alpha',
'gpSectionsColorPickerL10n',
array(
'defaultLabel' => __( 'Color value', 'gp-premium' ),
'pick' => __( 'Select Color', 'gp-premium' ),
'defaultString' => __( 'Default', 'gp-premium' ),
'defaultAriaLabel' => __( 'Select default color', 'gp-premium' ),
'clear' => __( 'Clear', 'gp-premium' ),
'clearAriaLabel' => __( 'Clear color', 'gp-premium' ),
)
);
wp_enqueue_media(); wp_enqueue_media();

View File

@ -830,3 +830,24 @@
pointer-events: none; pointer-events: none;
opacity: 0.2; opacity: 0.2;
} }
.refresh-sites a:first-child:before {
font: normal 20px/.5 dashicons;
speak: none;
display: inline-block;
padding: 0;
top: 9px;
left: -4px;
position: relative;
vertical-align: top;
content: "\f463";
}
.refresh-sites a:first-child.loading:before {
animation: rotation 1s infinite linear;
}
.refresh-sites a:first-child.success:before {
content: "\f147";
color: #46b450;
}

View File

@ -910,4 +910,20 @@ jQuery( document ).ready( function($) {
$( 'body' ).removeClass( 'site-import-content-exists' ); $( 'body' ).removeClass( 'site-import-content-exists' );
$( 'body' ).removeClass( 'site-import-data-exists' ); $( 'body' ).removeClass( 'site-import-data-exists' );
} ); } );
$( '.refresh-sites a:first-child' ).on( 'click', function( e ) {
var $thisButton = $( this ); // eslint-disable-line no-var
e.preventDefault();
$thisButton.removeClass( 'success' ).addClass( 'loading' );
$.post( ajaxurl, {
action: 'generate_sites_refresh_sites',
_nonce: $thisButton.data( 'nonce' ),
} ).done( function() {
$thisButton.removeClass( 'loading' ).addClass( 'success' );
$thisButton.hide();
$thisButton.next( '.button' ).show();
} );
} );
} ); } );

View File

@ -118,6 +118,15 @@ class GeneratePress_Sites_Restore {
update_option( $key, $val ); update_option( $key, $val );
} }
// Re-add non-theme option related theme mods.
if ( isset( $backup_data['site_options']['nav_menu_locations'] ) ) {
set_theme_mod( 'nav_menu_locations', $backup_data['site_options']['nav_menu_locations'] );
}
if ( isset( $backup_data['site_options']['custom_logo'] ) ) {
set_theme_mod( 'custom_logo', $backup_data['site_options']['custom_logo'] );
}
} }
wp_send_json( __( 'Theme options restored.', 'gp-premium' ) ); wp_send_json( __( 'Theme options restored.', 'gp-premium' ) );
@ -148,7 +157,11 @@ class GeneratePress_Sites_Restore {
if ( 'nav_menu_locations' === $key || 'custom_logo' === $key ) { if ( 'nav_menu_locations' === $key || 'custom_logo' === $key ) {
set_theme_mod( $key, $val ); set_theme_mod( $key, $val );
} else { } else {
update_option( $key, $val ); if ( ! $val && ! is_numeric( $val ) ) {
delete_option( $key );
} else {
update_option( $key, $val );
}
} }
} }
} }

View File

@ -768,9 +768,9 @@ class GeneratePress_Site {
continue; continue;
} }
// Import any images.
if ( is_array( $val ) || is_object( $val ) ) { if ( is_array( $val ) || is_object( $val ) ) {
foreach ( $val as $option_name => $option_value ) { foreach ( $val as $option_name => $option_value ) {
// Import any images.
if ( is_string( $option_value ) && preg_match( '/\.(jpg|jpeg|png|gif)/i', $option_value ) ) { if ( is_string( $option_value ) && preg_match( '/\.(jpg|jpeg|png|gif)/i', $option_value ) ) {
$data = GeneratePress_Sites_Helper::sideload_image( $option_value ); $data = GeneratePress_Sites_Helper::sideload_image( $option_value );
@ -778,12 +778,28 @@ class GeneratePress_Site {
$val[ $option_name ] = $data->url; $val[ $option_name ] = $data->url;
} }
} }
// Set these options if we import content.
unset( $val['hide_title'] );
unset( $val['hide_tagline'] );
unset( $val['logo_width'] );
} }
} }
update_option( $key, $val ); update_option( $key, $val );
} }
// Re-add non-theme option related theme mods.
set_theme_mod( 'nav_menu_locations', $backup_data['site_options']['nav_menu_locations'] );
set_theme_mod( 'custom_logo', $backup_data['site_options']['custom_logo'] );
$existing_settings = get_option( 'generate_settings', array() );
$existing_settings['hide_title'] = $backup_data['theme_options']['options']['generate_settings']['hide_title'];
$existing_settings['hide_tagline'] = $backup_data['theme_options']['options']['generate_settings']['hide_tagline'];
$existing_settings['logo_width'] = $backup_data['theme_options']['options']['generate_settings']['logo_width'];
update_option( 'generate_settings', $existing_settings );
// Remove dynamic CSS cache. // Remove dynamic CSS cache.
delete_option( 'generate_dynamic_css_output' ); delete_option( 'generate_dynamic_css_output' );
delete_option( 'generate_dynamic_css_cached_version' ); delete_option( 'generate_dynamic_css_cached_version' );
@ -1002,6 +1018,51 @@ class GeneratePress_Site {
} }
} }
// Set theme options.
$theme_settings = get_option( 'generate_settings', array() );
$update_theme_settings = false;
foreach ( $settings['options'] as $key => $val ) {
if ( 'generate_settings' !== $key ) {
continue;
}
if ( is_array( $val ) || is_object( $val ) ) {
foreach ( $val as $option_name => $option_value ) {
if ( 'hide_title' === $option_name ) {
$theme_settings['hide_title'] = $option_value;
$update_theme_settings = true;
}
if ( 'hide_tagline' === $option_name ) {
$theme_settings['hide_tagline'] = $option_value;
$update_theme_settings = true;
}
if ( 'logo_width' === $option_name ) {
$theme_settings['logo_width'] = $option_value;
$update_theme_settings = true;
}
}
}
}
if ( $update_theme_settings ) {
update_option( 'generate_settings', $theme_settings );
// Remove dynamic CSS cache.
delete_option( 'generate_dynamic_css_output' );
delete_option( 'generate_dynamic_css_cached_version' );
$dynamic_css_data = get_option( 'generatepress_dynamic_css_data', array() );
if ( isset( $dynamic_css_data['updated_time'] ) ) {
unset( $dynamic_css_data['updated_time'] );
}
update_option( 'generatepress_dynamic_css_data', $dynamic_css_data );
}
// Set our backed up options. // Set our backed up options.
update_option( '_generatepress_site_library_backup', $backup_data ); update_option( '_generatepress_site_library_backup', $backup_data );

View File

@ -323,6 +323,17 @@ class WXRImporter extends \WP_Importer {
add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) ); add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) );
add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) ); add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) );
/*
* Elementor fix for excessive use of `wp_slash` after our update v3.0.2.
* Method in Elementor: \Elementor\Compatibility::register_actions
* https://wordpress.org/support/topic/version-2-6-0-breaks-every-elementor-theme/
*
* This can be removed after Elementor skips the functionality in above method if our plugin is in use.
*/
if ( method_exists( '\Elementor\Compatibility', 'on_wxr_importer_pre_process_post_meta' ) ) {
remove_action( 'wxr_importer.pre_process.post_meta', array( 'Elementor\Compatibility', 'on_wxr_importer_pre_process_post_meta' ) );
}
$result = $this->import_start( $file ); $result = $this->import_start( $file );
if ( is_wp_error( $result ) ) { if ( is_wp_error( $result ) ) {
return $result; return $result;
@ -843,7 +854,7 @@ class WXRImporter extends \WP_Importer {
$postdata[ $key ] = $data[ $key ]; $postdata[ $key ] = $data[ $key ];
} }
$postdata = apply_filters( 'wp_import_post_data_processed', $postdata, $data ); $postdata = apply_filters( 'wp_import_post_data_processed', wp_slash( $postdata ), $data );
if ( 'attachment' === $postdata['post_type'] ) { if ( 'attachment' === $postdata['post_type'] ) {
if ( ! $this->options['fetch_attachments'] ) { if ( ! $this->options['fetch_attachments'] ) {
@ -1170,7 +1181,12 @@ class WXRImporter extends \WP_Importer {
$value = maybe_unserialize( $meta_item['value'] ); $value = maybe_unserialize( $meta_item['value'] );
} }
add_post_meta( $post_id, $key, $value ); if ( function_exists( 'wp_slash_strings_only' ) ) {
add_post_meta( $post_id, wp_slash( $key ), wp_slash_strings_only( $value ) );
} else {
add_post_meta( $post_id, $key, $value );
}
do_action( 'import_post_meta', $post_id, $key, $value ); do_action( 'import_post_meta', $post_id, $key, $value );
// if the post has a featured image, take note of this in case of remap // if the post has a featured image, take note of this in case of remap

View File

@ -261,18 +261,9 @@ function generate_sites_container() {
</select> </select>
</div> </div>
</div> </div>
<?php else : ?> <?php
<div class="page-builder-filter"> endif;
<label for="page-builder" class="page-builder-label"><?php _e( 'Page Builder:', 'gp-premium' ); ?></label> ?>
<div class="filter-select">
<select id="page-builder" class="page-builder-group" data-filter-group="page-builder" data-page-builder=".no-page-builder">
<option value="no-page-builder"><?php _e( 'None', 'gp-premium' ); ?></option>
<option value="beaver-builder"><?php _e( 'Beaver Builder', 'gp-premium' ); ?></option>
<option value="elementor"><?php _e( 'Elementor', 'gp-premium' ); ?></option>
</select>
</div>
</div>
<?php endif; ?>
</div> </div>
@ -314,10 +305,13 @@ function generate_sites_container() {
<?php <?php
printf( printf(
'<div class="refresh-sites"> '<div class="refresh-sites">
<a class="button" href="%1$s">%2$s</a> <a data-nonce="%1$s" class="button" href="#">%2$s</a>
<a class="button button-primary" href="%3$s" style="display: none;">%4$s</a>
</div>', </div>',
esc_url( wp_nonce_url( admin_url( 'themes.php?page=generatepress-site-library' ), 'refresh_sites', 'refresh_sites_nonce' ) ), esc_html( wp_create_nonce( 'refresh_sites_nonce' ) ),
__( 'Refresh Sites', 'gp-premium' ) __( 'Refresh Sites', 'gp-premium' ),
esc_url( admin_url( 'themes.php?page=generatepress-site-library' ) ),
__( 'Reload Page', 'gp-premium' )
); );
?> ?>
</div> </div>
@ -325,18 +319,21 @@ function generate_sites_container() {
<?php <?php
} }
add_action( 'admin_init', 'generate_sites_refresh_list', 2 ); add_action( 'wp_ajax_generate_sites_refresh_sites', 'generate_sites_do_refresh_list' );
/** /**
* Delete our sites transient if the Refresh sites link is clicked. * Refresh our list of sites.
*
* @since 1.6
*/ */
function generate_sites_refresh_list() { function generate_sites_do_refresh_list() {
if ( ! isset( $_GET['refresh_sites_nonce'] ) || ! wp_verify_nonce( $_GET['refresh_sites_nonce'], 'refresh_sites' ) ) { check_ajax_referer( 'refresh_sites_nonce', '_nonce' );
return;
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( __( 'Security check failed.', 'gp-premium' ) );
} }
delete_transient( 'generatepress_sites' ); delete_transient( 'generatepress_sites' );
generate_get_sites_from_library();
wp_send_json_success();
} }
/** /**
@ -487,6 +484,9 @@ add_action( 'generate_export_items', 'generatepress_sites_add_export_checkbox' )
* @since 1.7 * @since 1.7
*/ */
function generatepress_sites_add_export_checkbox() { function generatepress_sites_add_export_checkbox() {
if ( ! apply_filters( 'generate_show_generatepress_site_export_option', false ) ) {
return;
}
?> ?>
<hr style="margin:10px 0;border-bottom:0;" /> <hr style="margin:10px 0;border-bottom:0;" />
@ -573,6 +573,8 @@ function generatepress_sites_do_site_options_export( $data ) {
$data['site_options']['elementor_scheme_typography'] = get_option( 'elementor_scheme_typography' ); $data['site_options']['elementor_scheme_typography'] = get_option( 'elementor_scheme_typography' );
$data['site_options']['elementor_space_between_widgets'] = get_option( 'elementor_space_between_widgets' ); $data['site_options']['elementor_space_between_widgets'] = get_option( 'elementor_space_between_widgets' );
$data['site_options']['elementor_stretched_section_container'] = get_option( 'elementor_stretched_section_container' ); $data['site_options']['elementor_stretched_section_container'] = get_option( 'elementor_stretched_section_container' );
$data['site_options']['elementor_load_fa4_shim'] = get_option( 'elementor_load_fa4_shim' );
$data['site_options']['elementor_active_kit'] = get_option( 'elementor_active_kit' );
} }
// Beaver Builder. // Beaver Builder.
@ -647,6 +649,72 @@ function generatepress_sites_do_site_options_export( $data ) {
} }
/**
* Get our sites from the site server.
*
* @since 1.12.0
*/
function generate_get_sites_from_library() {
$remote_sites = get_transient( 'generatepress_sites' );
$trusted_authors = get_transient( 'generatepress_sites_trusted_providers' );
if ( empty( $remote_sites ) ) {
$sites = array();
$data = wp_safe_remote_get( 'https://gpsites.co/wp-json/wp/v2/sites?per_page=100' );
if ( is_wp_error( $data ) ) {
set_transient( 'generatepress_sites', 'no results', 5 * MINUTE_IN_SECONDS );
return;
}
$data = json_decode( wp_remote_retrieve_body( $data ), true );
if ( ! is_array( $data ) ) {
set_transient( 'generatepress_sites', 'no results', 5 * MINUTE_IN_SECONDS );
return;
}
foreach ( (array) $data as $site ) {
$sites[ $site['name'] ] = array(
'name' => $site['name'],
'directory' => $site['directory'],
'preview_url' => $site['preview_url'],
'author_name' => $site['author_name'],
'author_url' => $site['author_url'],
'description' => $site['description'],
'page_builder' => $site['page_builder'],
'min_version' => $site['min_version'],
'uploads_url' => $site['uploads_url'],
'plugins' => $site['plugins'],
'documentation' => $site['documentation'],
);
}
$sites = apply_filters( 'generate_add_sites', $sites );
set_transient( 'generatepress_sites', $sites, 24 * HOUR_IN_SECONDS );
}
if ( empty( $trusted_authors ) ) {
$trusted_authors = wp_safe_remote_get( 'https://gpsites.co/wp-json/sites/site' );
if ( is_wp_error( $trusted_authors ) || empty( $trusted_authors ) ) {
set_transient( 'generatepress_sites_trusted_providers', 'no results', 5 * MINUTE_IN_SECONDS );
return;
}
$trusted_authors = json_decode( wp_remote_retrieve_body( $trusted_authors ), true );
$authors = array();
foreach ( (array) $trusted_authors['trusted_author'] as $author ) {
$authors[] = $author;
}
set_transient( 'generatepress_sites_trusted_providers', $authors, 24 * HOUR_IN_SECONDS );
}
}
add_action( 'current_screen', 'generatepress_sites_init', 5 ); add_action( 'current_screen', 'generatepress_sites_init', 5 );
/** /**
* Fetch our sites and trusted authors. Stores them in their own transients. * Fetch our sites and trusted authors. Stores them in their own transients.
@ -658,64 +726,7 @@ function generatepress_sites_init() {
$screen = get_current_screen(); $screen = get_current_screen();
if ( 'appearance_page_generate-options' === $screen->id || 'appearance_page_generatepress-site-library' === $screen->id ) { if ( 'appearance_page_generate-options' === $screen->id || 'appearance_page_generatepress-site-library' === $screen->id ) {
$remote_sites = get_transient( 'generatepress_sites' ); generate_get_sites_from_library();
$trusted_authors = get_transient( 'generatepress_sites_trusted_providers' );
if ( empty( $remote_sites ) ) {
$sites = array();
$data = wp_safe_remote_get( 'https://gpsites.co/wp-json/wp/v2/sites?per_page=100' );
if ( is_wp_error( $data ) ) {
set_transient( 'generatepress_sites', 'no results', 5 * MINUTE_IN_SECONDS );
return;
}
$data = json_decode( wp_remote_retrieve_body( $data ), true );
if ( ! is_array( $data ) ) {
set_transient( 'generatepress_sites', 'no results', 5 * MINUTE_IN_SECONDS );
return;
}
foreach ( (array) $data as $site ) {
$sites[ $site['name'] ] = array(
'name' => $site['name'],
'directory' => $site['directory'],
'preview_url' => $site['preview_url'],
'author_name' => $site['author_name'],
'author_url' => $site['author_url'],
'description' => $site['description'],
'page_builder' => $site['page_builder'],
'min_version' => $site['min_version'],
'uploads_url' => $site['uploads_url'],
'plugins' => $site['plugins'],
'documentation' => $site['documentation'],
);
}
$sites = apply_filters( 'generate_add_sites', $sites );
set_transient( 'generatepress_sites', $sites, 24 * HOUR_IN_SECONDS );
}
if ( empty( $trusted_authors ) ) {
$trusted_authors = wp_safe_remote_get( 'https://gpsites.co/wp-json/sites/site' );
if ( is_wp_error( $trusted_authors ) || empty( $trusted_authors ) ) {
set_transient( 'generatepress_sites_trusted_providers', 'no results', 5 * MINUTE_IN_SECONDS );
return;
}
$trusted_authors = json_decode( wp_remote_retrieve_body( $trusted_authors ), true );
$authors = array();
foreach ( (array) $trusted_authors['trusted_author'] as $author ) {
$authors[] = $author;
}
set_transient( 'generatepress_sites_trusted_providers', $authors, 24 * HOUR_IN_SECONDS );
}
} }
} }

View File

@ -87,6 +87,18 @@ generate_spacing_live_update( 'mobile_header_right', 'mobile_header_right', '.in
generate_spacing_live_update( 'mobile_header_bottom', 'mobile_header_bottom', '.inside-header', 'padding-bottom', false, false, gp_spacing.mobile ); generate_spacing_live_update( 'mobile_header_bottom', 'mobile_header_bottom', '.inside-header', 'padding-bottom', false, false, gp_spacing.mobile );
generate_spacing_live_update( 'mobile_header_left', 'mobile_header_left', '.inside-header', 'padding-left', false, false, gp_spacing.mobile ); generate_spacing_live_update( 'mobile_header_left', 'mobile_header_left', '.inside-header', 'padding-left', false, false, gp_spacing.mobile );
jQuery( window ).on( 'load', function() {
var containerAlignment = wp.customize( 'generate_settings[container_alignment]' ).get();
if ( gp_spacing.isFlex && 'text' === containerAlignment ) {
generate_spacing_live_update( 'header_left_sticky_nav', 'header_left', '.main-navigation.navigation-stick:not(.has-branding) .inside-navigation.grid-container', 'padding-left', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'header_right_sticky_nav', 'header_right', '.main-navigation.navigation-stick:not(.has-branding) .inside-navigation.grid-container', 'padding-right', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'mobile_header_left_sticky_nav', 'mobile_header_left', '.main-navigation.navigation-stick:not(.has-branding) .inside-navigation.grid-container', 'padding-left', false, false, gp_spacing.mobile );
generate_spacing_live_update( 'mobile_header_right_sticky_nav', 'mobile_header_right', '.main-navigation.navigation-stick:not(.has-branding) .inside-navigation.grid-container', 'padding-right', false, false, gp_spacing.mobile );
}
} );
/** /**
* Content padding * Content padding
*/ */
@ -103,6 +115,17 @@ generate_spacing_live_update( 'content_right', 'content_right', content_areas, '
generate_spacing_live_update( 'content_bottom', 'content_bottom', content_areas, 'padding-bottom', false, false, gp_spacing.desktop ); generate_spacing_live_update( 'content_bottom', 'content_bottom', content_areas, 'padding-bottom', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'content_left', 'content_left', content_areas, 'padding-left', false, false, gp_spacing.desktop ); generate_spacing_live_update( 'content_left', 'content_left', content_areas, 'padding-left', false, false, gp_spacing.desktop );
jQuery( window ).on( 'load', function() {
var containerAlignment = wp.customize( 'generate_settings[container_alignment]' ).get();
if ( gp_spacing.isFlex && 'text' === containerAlignment ) {
generate_spacing_live_update( 'content_left_nav_as_header', 'content_left', '.main-navigation.has-branding .inside-navigation.grid-container, .main-navigation.has-branding .inside-navigation.grid-container', 'padding-left', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'content_right_nav_as_header', 'content_right', '.main-navigation.has-branding .inside-navigation.grid-container, .main-navigation.has-branding .inside-navigation.grid-container', 'padding-right', false, false, gp_spacing.desktop );
}
} );
generate_spacing_live_update( 'one_container_post_content_bottom', 'content_bottom', '.one-container.archive .post:not(:last-child),.one-container.blog .post:not(:last-child)', 'padding-bottom' );
/* Mobile content padding */ /* Mobile content padding */
generate_spacing_live_update( 'mobile_content_top', 'mobile_content_top', content_areas, 'padding-top', false, false, gp_spacing.mobile ); generate_spacing_live_update( 'mobile_content_top', 'mobile_content_top', content_areas, 'padding-top', false, false, gp_spacing.mobile );
generate_spacing_live_update( 'mobile_content_right', 'mobile_content_right', content_areas, 'padding-right', false, false, gp_spacing.mobile ); generate_spacing_live_update( 'mobile_content_right', 'mobile_content_right', content_areas, 'padding-right', false, false, gp_spacing.mobile );
@ -116,7 +139,7 @@ generate_spacing_live_update( 'content-margin-left-both', 'content_left', '.one-
/* Content element separator */ /* Content element separator */
generate_spacing_live_update( 'content_element_separator_top', 'content_element_separator', '.post-image, .page-content, .entry-content, .entry-summary, footer.entry-meta', 'margin-top', false, false, false, 'em' ); generate_spacing_live_update( 'content_element_separator_top', 'content_element_separator', '.post-image:not(:first-child), .page-content:not(:first-child), .entry-content:not(:first-child), .entry-summary:not(:first-child), footer.entry-meta', 'margin-top', false, false, false, 'em' );
generate_spacing_live_update( 'content_element_separator_bottom', 'content_element_separator', '.post-image-above-header .inside-article div.featured-image, .post-image-above-header .inside-article div.post-image', 'margin-bottom', false, false, false, 'em' ); generate_spacing_live_update( 'content_element_separator_bottom', 'content_element_separator', '.post-image-above-header .inside-article div.featured-image, .post-image-above-header .inside-article div.post-image', 'margin-bottom', false, false, false, 'em' );
/** /**
@ -278,26 +301,51 @@ generate_spacing_live_update( 'mobile_widget_right', 'mobile_widget_right', '.wi
generate_spacing_live_update( 'mobile_widget_bottom', 'mobile_widget_bottom', '.widget-area .widget', 'padding-bottom', false, false, gp_spacing.mobile ); generate_spacing_live_update( 'mobile_widget_bottom', 'mobile_widget_bottom', '.widget-area .widget', 'padding-bottom', false, false, gp_spacing.mobile );
generate_spacing_live_update( 'mobile_widget_left', 'mobile_widget_left', '.widget-area .widget', 'padding-left', false, false, gp_spacing.mobile ); generate_spacing_live_update( 'mobile_widget_left', 'mobile_widget_left', '.widget-area .widget', 'padding-left', false, false, gp_spacing.mobile );
/**
* Footer widget area
*/
generate_spacing_live_update( 'footer_widget_container_top', 'footer_widget_container_top', '.footer-widgets', 'padding-top', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'footer_widget_container_right', 'footer_widget_container_right', '.footer-widgets', 'padding-right', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'footer_widget_container_bottom', 'footer_widget_container_bottom', '.footer-widgets', 'padding-bottom', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'footer_widget_container_left', 'footer_widget_container_left', '.footer-widgets', 'padding-left', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'mobile_footer_widget_container_top', 'mobile_footer_widget_container_top', '.footer-widgets', 'padding-top', false, false, gp_spacing.mobile ); if ( gp_spacing.isFlex ) {
generate_spacing_live_update( 'mobile_footer_widget_container_right', 'mobile_footer_widget_container_right', '.footer-widgets', 'padding-right', false, false, gp_spacing.mobile ); /**
generate_spacing_live_update( 'mobile_footer_widget_container_bottom', 'mobile_footer_widget_container_bottom', '.footer-widgets', 'padding-bottom', false, false, gp_spacing.mobile ); * Footer widget area
generate_spacing_live_update( 'mobile_footer_widget_container_left', 'mobile_footer_widget_container_left', '.footer-widgets', 'padding-left', false, false, gp_spacing.mobile ); */
generate_spacing_live_update( 'footer_widget_container_top', 'footer_widget_container_top', '.footer-widgets-container', 'padding-top', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'footer_widget_container_right', 'footer_widget_container_right', '.footer-widgets-container', 'padding-right', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'footer_widget_container_bottom', 'footer_widget_container_bottom', '.footer-widgets-container', 'padding-bottom', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'footer_widget_container_left', 'footer_widget_container_left', '.footer-widgets-container', 'padding-left', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'mobile_footer_widget_container_top', 'mobile_footer_widget_container_top', '.footer-widgets-container', 'padding-top', false, false, gp_spacing.mobile );
generate_spacing_live_update( 'mobile_footer_widget_container_right', 'mobile_footer_widget_container_right', '.footer-widgets-container', 'padding-right', false, false, gp_spacing.mobile );
generate_spacing_live_update( 'mobile_footer_widget_container_bottom', 'mobile_footer_widget_container_bottom', '.footer-widgets-container', 'padding-bottom', false, false, gp_spacing.mobile );
generate_spacing_live_update( 'mobile_footer_widget_container_left', 'mobile_footer_widget_container_left', '.footer-widgets-container', 'padding-left', false, false, gp_spacing.mobile );
/**
* Footer
*/
generate_spacing_live_update( 'footer_top', 'footer_top', '.inside-site-info', 'padding-top' );
generate_spacing_live_update( 'footer_right', 'footer_right', '.inside-site-info', 'padding-right' );
generate_spacing_live_update( 'footer_bottom', 'footer_bottom', '.inside-site-info', 'padding-bottom' );
generate_spacing_live_update( 'footer_left', 'footer_left', '.inside-site-info', 'padding-left' );
} else {
/**
* Footer widget area
*/
generate_spacing_live_update( 'footer_widget_container_top', 'footer_widget_container_top', '.footer-widgets', 'padding-top', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'footer_widget_container_right', 'footer_widget_container_right', '.footer-widgets', 'padding-right', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'footer_widget_container_bottom', 'footer_widget_container_bottom', '.footer-widgets', 'padding-bottom', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'footer_widget_container_left', 'footer_widget_container_left', '.footer-widgets', 'padding-left', false, false, gp_spacing.desktop );
generate_spacing_live_update( 'mobile_footer_widget_container_top', 'mobile_footer_widget_container_top', '.footer-widgets', 'padding-top', false, false, gp_spacing.mobile );
generate_spacing_live_update( 'mobile_footer_widget_container_right', 'mobile_footer_widget_container_right', '.footer-widgets', 'padding-right', false, false, gp_spacing.mobile );
generate_spacing_live_update( 'mobile_footer_widget_container_bottom', 'mobile_footer_widget_container_bottom', '.footer-widgets', 'padding-bottom', false, false, gp_spacing.mobile );
generate_spacing_live_update( 'mobile_footer_widget_container_left', 'mobile_footer_widget_container_left', '.footer-widgets', 'padding-left', false, false, gp_spacing.mobile );
/**
* Footer
*/
generate_spacing_live_update( 'footer_top', 'footer_top', '.site-info', 'padding-top' );
generate_spacing_live_update( 'footer_right', 'footer_right', '.site-info', 'padding-right' );
generate_spacing_live_update( 'footer_bottom', 'footer_bottom', '.site-info', 'padding-bottom' );
generate_spacing_live_update( 'footer_left', 'footer_left', '.site-info', 'padding-left' );
}
/**
* Footer
*/
generate_spacing_live_update( 'footer_top', 'footer_top', '.site-info', 'padding-top' );
generate_spacing_live_update( 'footer_right', 'footer_right', '.site-info', 'padding-right' );
generate_spacing_live_update( 'footer_bottom', 'footer_bottom', '.site-info', 'padding-bottom' );
generate_spacing_live_update( 'footer_left', 'footer_left', '.site-info', 'padding-left' );
/** /**
* Separator * Separator
@ -317,7 +365,7 @@ if ( jQuery( 'body' ).hasClass( 'masonry-enabled' ) ) {
if ( jQuery( 'body' ).hasClass( 'generate-columns-activated' ) ) { if ( jQuery( 'body' ).hasClass( 'generate-columns-activated' ) ) {
generate_spacing_live_update( 'columns_bottom', 'separator', '.generate-columns', 'margin-bottom' ); generate_spacing_live_update( 'columns_bottom', 'separator', '.generate-columns', 'margin-bottom' );
generate_spacing_live_update( 'columns_left', 'separator', '.generate-columns', 'padding-left' ); generate_spacing_live_update( 'columns_left', 'separator', '.generate-columns', 'padding-left' );
generate_spacing_live_update( 'columns_container', 'separator', '.generate-columns-container', 'padding-left', 'negative' ); generate_spacing_live_update( 'columns_container', 'separator', '.generate-columns-container', 'margin-left', 'negative' );
generate_spacing_live_update( 'columns_page_header_bottom', 'separator', '.generate-columns-container .page-header', 'margin-bottom' ); generate_spacing_live_update( 'columns_page_header_bottom', 'separator', '.generate-columns-container .page-header', 'margin-bottom' );
generate_spacing_live_update( 'columns_page_header_left', 'separator', '.generate-columns-container .page-header', 'margin-left' ); generate_spacing_live_update( 'columns_page_header_left', 'separator', '.generate-columns-container .page-header', 'margin-left' );
generate_spacing_live_update( 'columns_pagination', 'separator', '.separate-containers .generate-columns-container > .paging-navigation', 'margin-left' ); generate_spacing_live_update( 'columns_pagination', 'separator', '.separate-containers .generate-columns-container > .paging-navigation', 'margin-left' );
@ -347,8 +395,14 @@ if ( jQuery( 'body' ).hasClass( 'both-right' ) ) {
generate_spacing_live_update( 'both_right_sidebar_sepatator_top', 'separator', '.both-right.separate-containers .site-main', 'margin-top' ); generate_spacing_live_update( 'both_right_sidebar_sepatator_top', 'separator', '.both-right.separate-containers .site-main', 'margin-top' );
generate_spacing_live_update( 'both_right_sidebar_sepatator_right', 'separator', '.both-right.separate-containers .site-main', 'margin-right' ); generate_spacing_live_update( 'both_right_sidebar_sepatator_right', 'separator', '.both-right.separate-containers .site-main', 'margin-right' );
generate_spacing_live_update( 'both_right_sidebar_sepatator_bottom', 'separator', '.both-right.separate-containers .site-main', 'margin-bottom' ); generate_spacing_live_update( 'both_right_sidebar_sepatator_bottom', 'separator', '.both-right.separate-containers .site-main', 'margin-bottom' );
generate_spacing_live_update( 'both_right_left_sidebar', 'separator', '.both-right.separate-containers .inside-left-sidebar', 'margin-right', false, true );
generate_spacing_live_update( 'both_right_right_sidebar', 'separator', '.both-right.separate-containers .inside-right-sidebar', 'margin-left', false, true ); if ( gp_spacing.isFlex ) {
generate_spacing_live_update( 'both_right_left_sidebar', 'separator', '.both-right .inside-left-sidebar', 'margin-right', false, true );
generate_spacing_live_update( 'both_right_right_sidebar', 'separator', '.both-right .inside-right-sidebar', 'margin-left', false, true );
} else {
generate_spacing_live_update( 'both_right_left_sidebar', 'separator', '.both-right.separate-containers .inside-left-sidebar', 'margin-right', false, true );
generate_spacing_live_update( 'both_right_right_sidebar', 'separator', '.both-right.separate-containers .inside-right-sidebar', 'margin-left', false, true );
}
} }
/* Both sidebars left */ /* Both sidebars left */
@ -356,8 +410,14 @@ if ( jQuery( 'body' ).hasClass( 'both-left' ) ) {
generate_spacing_live_update( 'both_left_sidebar_sepatator_top', 'separator', '.both-left.separate-containers .site-main', 'margin-top' ); generate_spacing_live_update( 'both_left_sidebar_sepatator_top', 'separator', '.both-left.separate-containers .site-main', 'margin-top' );
generate_spacing_live_update( 'both_left_sidebar_sepatator_right', 'separator', '.both-left.separate-containers .site-main', 'margin-bottom' ); generate_spacing_live_update( 'both_left_sidebar_sepatator_right', 'separator', '.both-left.separate-containers .site-main', 'margin-bottom' );
generate_spacing_live_update( 'both_left_sidebar_sepatator_bottom', 'separator', '.both-left.separate-containers .site-main', 'margin-left' ); generate_spacing_live_update( 'both_left_sidebar_sepatator_bottom', 'separator', '.both-left.separate-containers .site-main', 'margin-left' );
generate_spacing_live_update( 'both_left_left_sidebar', 'separator', '.both-left.separate-containers .inside-left-sidebar', 'margin-right', false, true );
generate_spacing_live_update( 'both_left_right_sidebar', 'separator', '.both-left.separate-containers .inside-right-sidebar', 'margin-left', false, true ); if ( gp_spacing.isFlex ) {
generate_spacing_live_update( 'both_left_left_sidebar', 'separator', '.both-left .inside-left-sidebar', 'margin-right', false, true );
generate_spacing_live_update( 'both_left_right_sidebar', 'separator', '.both-left .inside-right-sidebar', 'margin-left', false, true );
} else {
generate_spacing_live_update( 'both_left_left_sidebar', 'separator', '.both-left.separate-containers .inside-left-sidebar', 'margin-right', false, true );
generate_spacing_live_update( 'both_left_right_sidebar', 'separator', '.both-left.separate-containers .inside-right-sidebar', 'margin-left', false, true );
}
} }
/* Main element margin */ /* Main element margin */
@ -365,22 +425,34 @@ generate_spacing_live_update( 'site_main_separator_top', 'separator', '.separate
generate_spacing_live_update( 'site_main_separator_bottom', 'separator', '.separate-containers .site-main', 'margin-bottom' ); generate_spacing_live_update( 'site_main_separator_bottom', 'separator', '.separate-containers .site-main', 'margin-bottom' );
/* Page header element */ /* Page header element */
generate_spacing_live_update( 'page_header_separator_top', 'separator', if ( gp_spacing.isFlex ) {
'.separate-containers .page-header-image, \ generate_spacing_live_update( 'page_header_separator_top', 'separator', '.separate-containers .featured-image', 'margin-top' );
.separate-containers .page-header-contained, \ } else {
.separate-containers .page-header-image-single, \ generate_spacing_live_update( 'page_header_separator_top', 'separator',
.separate-containers .page-header-content-single', 'margin-top' ); '.separate-containers .page-header-image, \
.separate-containers .page-header-contained, \
.separate-containers .page-header-image-single, \
.separate-containers .page-header-content-single', 'margin-top' );
}
/* Top and bottom sidebar margin */ /* Top and bottom sidebar margin */
generate_spacing_live_update( 'right_sidebar_separator_top', 'separator', '.separate-containers .inside-right-sidebar, .separate-containers .inside-left-sidebar', 'margin-top' ); generate_spacing_live_update( 'right_sidebar_separator_top', 'separator', '.separate-containers .inside-right-sidebar, .separate-containers .inside-left-sidebar', 'margin-top' );
generate_spacing_live_update( 'right_sidebar_separator_bottom', 'separator', '.separate-containers .inside-right-sidebar, .separate-containers .inside-left-sidebar', 'margin-bottom' ); generate_spacing_live_update( 'right_sidebar_separator_bottom', 'separator', '.separate-containers .inside-right-sidebar, .separate-containers .inside-left-sidebar', 'margin-bottom' );
/* Element separators */ /* Element separators */
generate_spacing_live_update( 'content_separator', 'separator', if ( gp_spacing.isFlex ) {
'.separate-containers .widget, \ generate_spacing_live_update( 'content_separator', 'separator',
.separate-containers .site-main > *, \ '.sidebar .widget, \
.separate-containers .page-header, \ .site-main > *, \
.widget-area .main-navigation', 'margin-bottom' ); .page-header, \
.widget-area .main-navigation', 'margin-bottom' );
} else {
generate_spacing_live_update( 'content_separator', 'separator',
'.separate-containers .widget, \
.separate-containers .site-main > *, \
.separate-containers .page-header, \
.widget-area .main-navigation', 'margin-bottom' );
}
/** /**
* Right sidebar width * Right sidebar width
@ -391,11 +463,22 @@ wp.customize( 'generate_spacing_settings[right_sidebar_width]', function( value
if ( jQuery( '#right-sidebar' ).length ) { if ( jQuery( '#right-sidebar' ).length ) {
if ( gp_spacing.isFlex ) { if ( gp_spacing.isFlex ) {
var rightSidebar = jQuery( '#right-sidebar' ); var contentWidth = 100,
leftSidebar = jQuery( '#left-sidebar' ).length ? wp.customize.value('generate_spacing_settings[left_sidebar_width]')() : 0;
if ( rightSidebar.length ) { if ( body.hasClass( 'right-sidebar' ) ) {
rightSidebar.css( 'width', newval + '%' ); contentWidth = ( Number( contentWidth ) - Number( newval ) );
} else if ( ! body.hasClass( 'left-sidebar' ) && ! body.hasClass( 'no-sidebar' ) ) {
var totalSidebarWidth = ( Number( leftSidebar ) + Number( newval ) );
contentWidth = ( Number( contentWidth ) - Number( totalSidebarWidth ) );
} }
jQuery( 'head' ).append( '<style id="right_sidebar_width">.is-right-sidebar{width:' + newval + '%;}.site-content .content-area{width:' + contentWidth + '%;}</style>' );
setTimeout(function() {
jQuery( 'style#right_sidebar_width' ).not( ':last' ).remove();
}, 200 );
} else { } else {
// Left sidebar width // Left sidebar width
var left_sidebar = ( jQuery( '#left-sidebar' ).length ) ? wp.customize.value('generate_spacing_settings[left_sidebar_width]')() : 0; var left_sidebar = ( jQuery( '#left-sidebar' ).length ) ? wp.customize.value('generate_spacing_settings[left_sidebar_width]')() : 0;
@ -466,11 +549,22 @@ wp.customize( 'generate_spacing_settings[left_sidebar_width]', function( value )
var body = jQuery( 'body' ); var body = jQuery( 'body' );
if ( jQuery( '#left-sidebar' ).length ) { if ( jQuery( '#left-sidebar' ).length ) {
if ( gp_spacing.isFlex ) { if ( gp_spacing.isFlex ) {
var leftSidebar = jQuery( '#left-sidebar' ); var contentWidth = 100,
rightSidebar = jQuery( '#right-sidebar' ).length ? wp.customize.value('generate_spacing_settings[right_sidebar_width]')() : 0;
if ( leftSidebar.length ) { if ( body.hasClass( 'left-sidebar' ) ) {
leftSidebar.css( 'width', newval + '%' ); contentWidth = ( Number( contentWidth ) - Number( newval ) );
} else if ( ! body.hasClass( 'right-sidebar' ) && ! body.hasClass( 'no-sidebar' ) ) {
var totalSidebarWidth = ( Number( rightSidebar ) + Number( newval ) );
contentWidth = ( Number( contentWidth ) - Number( totalSidebarWidth ) );
} }
jQuery( 'head' ).append( '<style id="left_sidebar_width">.is-left-sidebar{width:' + newval + '%;}.site-content .content-area{width:' + contentWidth + '%;}</style>' );
setTimeout(function() {
jQuery( 'style#left_sidebar_width' ).not( ':last' ).remove();
}, 200 );
} else { } else {
// Right sidebar width // Right sidebar width
var right_sidebar = ( jQuery( '#right-sidebar' ).length ) ? wp.customize.value('generate_spacing_settings[right_sidebar_width]')() : 0; var right_sidebar = ( jQuery( '#right-sidebar' ).length ) ? wp.customize.value('generate_spacing_settings[right_sidebar_width]')() : 0;

View File

@ -161,20 +161,23 @@ if ( ! function_exists( 'generate_spacing_premium_defaults' ) ) {
$defaults['off_canvas_menu_item_height'] = ''; $defaults['off_canvas_menu_item_height'] = '';
$defaults['content_element_separator'] = '2'; // em. $defaults['content_element_separator'] = '2'; // em.
$defaults['mobile_header_top'] = ''; // These defaults were added to GeneratePress (free) in 3.0.0.
$defaults['mobile_header_right'] = ''; if ( defined( 'GENERATE_VERSION' ) && version_compare( GENERATE_VERSION, '3.0.0-alpha.1', '<' ) ) {
$defaults['mobile_header_bottom'] = ''; $defaults['mobile_header_top'] = '';
$defaults['mobile_header_left'] = ''; $defaults['mobile_header_right'] = '';
$defaults['mobile_header_bottom'] = '';
$defaults['mobile_header_left'] = '';
$defaults['mobile_widget_top'] = ''; $defaults['mobile_widget_top'] = '';
$defaults['mobile_widget_right'] = ''; $defaults['mobile_widget_right'] = '';
$defaults['mobile_widget_bottom'] = ''; $defaults['mobile_widget_bottom'] = '';
$defaults['mobile_widget_left'] = ''; $defaults['mobile_widget_left'] = '';
$defaults['mobile_footer_widget_container_top'] = ''; $defaults['mobile_footer_widget_container_top'] = '';
$defaults['mobile_footer_widget_container_right'] = ''; $defaults['mobile_footer_widget_container_right'] = '';
$defaults['mobile_footer_widget_container_bottom'] = ''; $defaults['mobile_footer_widget_container_bottom'] = '';
$defaults['mobile_footer_widget_container_left'] = ''; $defaults['mobile_footer_widget_container_left'] = '';
}
return $defaults; return $defaults;
} }
@ -211,73 +214,79 @@ function generate_spacing_do_premium_css() {
$premium_css->set_selector( '.main-navigation .main-nav ul li a,.main-navigation .menu-toggle,.main-navigation .mobile-bar-items a,.main-navigation .menu-bar-item > a' ); $premium_css->set_selector( '.main-navigation .main-nav ul li a,.main-navigation .menu-toggle,.main-navigation .mobile-bar-items a,.main-navigation .menu-bar-item > a' );
$premium_css->add_property( 'line-height', absint( $spacing_settings['mobile_menu_item_height'] ), false, 'px' ); $premium_css->add_property( 'line-height', absint( $spacing_settings['mobile_menu_item_height'] ), false, 'px' );
$premium_css->set_selector( '.main-navigation .site-logo.navigation-logo img, .mobile-header-navigation .site-logo.mobile-header-logo img, .navigation-search input' ); $premium_css->set_selector( '.main-navigation .site-logo.navigation-logo img, .mobile-header-navigation .site-logo.mobile-header-logo img, .navigation-search input[type="search"]' );
$premium_css->add_property( 'height', absint( $spacing_settings['mobile_menu_item_height'] ), false, 'px' ); $premium_css->add_property( 'height', absint( $spacing_settings['mobile_menu_item_height'] ), false, 'px' );
} }
$premium_css->stop_media_query(); $premium_css->stop_media_query();
$premium_css->start_media_query( generate_premium_get_media_query( 'mobile' ) ); // This CSS was added to GeneratePress (free) in 3.0.0.
if ( defined( 'GENERATE_VERSION' ) && version_compare( GENERATE_VERSION, '3.0.0-alpha.1', '<' ) ) {
$premium_css->start_media_query( generate_premium_get_media_query( 'mobile' ) );
$premium_css->set_selector( '.inside-header' ); $premium_css->set_selector( '.inside-header' );
if ( '' !== $spacing_settings['mobile_header_top'] ) { if ( '' !== $spacing_settings['mobile_header_top'] ) {
$premium_css->add_property( 'padding-top', absint( $spacing_settings['mobile_header_top'] ), false, 'px' ); $premium_css->add_property( 'padding-top', absint( $spacing_settings['mobile_header_top'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_header_right'] ) {
$premium_css->add_property( 'padding-right', absint( $spacing_settings['mobile_header_right'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_header_bottom'] ) {
$premium_css->add_property( 'padding-bottom', absint( $spacing_settings['mobile_header_bottom'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_header_left'] ) {
$premium_css->add_property( 'padding-left', absint( $spacing_settings['mobile_header_left'] ), false, 'px' );
}
$premium_css->set_selector( '.widget-area .widget' );
if ( '' !== $spacing_settings['mobile_widget_top'] ) {
$premium_css->add_property( 'padding-top', absint( $spacing_settings['mobile_widget_top'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_widget_right'] ) {
$premium_css->add_property( 'padding-right', absint( $spacing_settings['mobile_widget_right'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_widget_bottom'] ) {
$premium_css->add_property( 'padding-bottom', absint( $spacing_settings['mobile_widget_bottom'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_widget_left'] ) {
$premium_css->add_property( 'padding-left', absint( $spacing_settings['mobile_widget_left'] ), false, 'px' );
}
$premium_css->set_selector( '.footer-widgets' );
if ( '' !== $spacing_settings['mobile_footer_widget_container_top'] ) {
$premium_css->add_property( 'padding-top', absint( $spacing_settings['mobile_footer_widget_container_top'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_footer_widget_container_right'] ) {
$premium_css->add_property( 'padding-right', absint( $spacing_settings['mobile_footer_widget_container_right'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_footer_widget_container_bottom'] ) {
$premium_css->add_property( 'padding-bottom', absint( $spacing_settings['mobile_footer_widget_container_bottom'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_footer_widget_container_left'] ) {
$premium_css->add_property( 'padding-left', absint( $spacing_settings['mobile_footer_widget_container_left'] ), false, 'px' );
}
$premium_css->stop_media_query();
$premium_css->set_selector( '.post-image, .page-content, .entry-content, .entry-summary, footer.entry-meta' );
$premium_css->add_property( 'margin-top', floatval( $spacing_settings['content_element_separator'] ), '2', 'em' );
} else {
$premium_css->set_selector( '.post-image:not(:first-child), .page-content:not(:first-child), .entry-content:not(:first-child), .entry-summary:not(:first-child), footer.entry-meta' );
$premium_css->add_property( 'margin-top', floatval( $spacing_settings['content_element_separator'] ), '2', 'em' );
} }
if ( '' !== $spacing_settings['mobile_header_right'] ) {
$premium_css->add_property( 'padding-right', absint( $spacing_settings['mobile_header_right'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_header_bottom'] ) {
$premium_css->add_property( 'padding-bottom', absint( $spacing_settings['mobile_header_bottom'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_header_left'] ) {
$premium_css->add_property( 'padding-left', absint( $spacing_settings['mobile_header_left'] ), false, 'px' );
}
$premium_css->set_selector( '.widget-area .widget' );
if ( '' !== $spacing_settings['mobile_widget_top'] ) {
$premium_css->add_property( 'padding-top', absint( $spacing_settings['mobile_widget_top'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_widget_right'] ) {
$premium_css->add_property( 'padding-right', absint( $spacing_settings['mobile_widget_right'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_widget_bottom'] ) {
$premium_css->add_property( 'padding-bottom', absint( $spacing_settings['mobile_widget_bottom'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_widget_left'] ) {
$premium_css->add_property( 'padding-left', absint( $spacing_settings['mobile_widget_left'] ), false, 'px' );
}
$premium_css->set_selector( '.footer-widgets' );
if ( '' !== $spacing_settings['mobile_footer_widget_container_top'] ) {
$premium_css->add_property( 'padding-top', absint( $spacing_settings['mobile_footer_widget_container_top'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_footer_widget_container_right'] ) {
$premium_css->add_property( 'padding-right', absint( $spacing_settings['mobile_footer_widget_container_right'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_footer_widget_container_bottom'] ) {
$premium_css->add_property( 'padding-bottom', absint( $spacing_settings['mobile_footer_widget_container_bottom'] ), false, 'px' );
}
if ( '' !== $spacing_settings['mobile_footer_widget_container_left'] ) {
$premium_css->add_property( 'padding-left', absint( $spacing_settings['mobile_footer_widget_container_left'] ), false, 'px' );
}
$premium_css->stop_media_query();
$premium_css->set_selector( '.post-image, .page-content, .entry-content, .entry-summary, footer.entry-meta' );
$premium_css->add_property( 'margin-top', floatval( $spacing_settings['content_element_separator'] ), '2', 'em' );
$premium_css->set_selector( '.post-image-above-header .inside-article div.featured-image, .post-image-above-header .inside-article div.post-image' ); $premium_css->set_selector( '.post-image-above-header .inside-article div.featured-image, .post-image-above-header .inside-article div.post-image' );
$premium_css->add_property( 'margin-bottom', floatval( $spacing_settings['content_element_separator'] ), '2', 'em' ); $premium_css->add_property( 'margin-bottom', floatval( $spacing_settings['content_element_separator'] ), '2', 'em' );
@ -293,7 +302,7 @@ function generate_spacing_do_premium_css() {
$premium_css->set_selector( '.main-navigation.sticky-navigation-transition .main-nav > ul > li > a,.sticky-navigation-transition .menu-toggle,.main-navigation.sticky-navigation-transition .mobile-bar-items a, .sticky-navigation-transition .navigation-branding .main-title' ); $premium_css->set_selector( '.main-navigation.sticky-navigation-transition .main-nav > ul > li > a,.sticky-navigation-transition .menu-toggle,.main-navigation.sticky-navigation-transition .mobile-bar-items a, .sticky-navigation-transition .navigation-branding .main-title' );
$premium_css->add_property( 'line-height', absint( $spacing_settings['sticky_menu_item_height'] ), false, 'px' ); $premium_css->add_property( 'line-height', absint( $spacing_settings['sticky_menu_item_height'] ), false, 'px' );
$premium_css->set_selector( '.main-navigation.sticky-navigation-transition .site-logo img, .main-navigation.sticky-navigation-transition .navigation-search input, .main-navigation.sticky-navigation-transition .navigation-branding img' ); $premium_css->set_selector( '.main-navigation.sticky-navigation-transition .site-logo img, .main-navigation.sticky-navigation-transition .navigation-search input[type="search"], .main-navigation.sticky-navigation-transition .navigation-branding img' );
$premium_css->add_property( 'height', absint( $spacing_settings['sticky_menu_item_height'] ), false, 'px' ); $premium_css->add_property( 'height', absint( $spacing_settings['sticky_menu_item_height'] ), false, 'px' );
$premium_css->stop_media_query(); $premium_css->stop_media_query();

View File

@ -472,7 +472,7 @@ if ( ! function_exists( 'generate_fonts_customize_register' ) ) {
array( array(
'default' => $defaults['tablet_site_title_font_size'], 'default' => $defaults['tablet_site_title_font_size'],
'type' => 'option', 'type' => 'option',
'sanitize_callback' => 'absint', 'sanitize_callback' => 'generate_premium_sanitize_empty_absint',
'transport' => 'postMessage', 'transport' => 'postMessage',
) )
); );
@ -482,7 +482,7 @@ if ( ! function_exists( 'generate_fonts_customize_register' ) ) {
array( array(
'default' => $defaults['mobile_site_title_font_size'], 'default' => $defaults['mobile_site_title_font_size'],
'type' => 'option', 'type' => 'option',
'sanitize_callback' => 'absint', 'sanitize_callback' => 'generate_premium_sanitize_empty_absint',
'transport' => 'postMessage', 'transport' => 'postMessage',
) )
); );
@ -1618,6 +1618,42 @@ if ( ! function_exists( 'generate_fonts_customize_register' ) ) {
) )
); );
$h3_font_size_options = array(
'desktop' => array(
'min' => 10,
'max' => 80,
'step' => 1,
'edit' => true,
'unit' => 'px',
),
);
$h3_font_size_settings = array(
'desktop' => 'generate_settings[heading_3_font_size]',
);
if ( isset( $defaults['mobile_heading_3_font_size'] ) ) {
$wp_customize->add_setting(
'generate_settings[mobile_heading_3_font_size]',
array(
'default' => $defaults['mobile_heading_3_font_size'],
'type' => 'option',
'sanitize_callback' => 'generate_premium_sanitize_empty_absint',
'transport' => 'postMessage',
)
);
$h3_font_size_options['mobile'] = array(
'min' => 10,
'max' => 80,
'step' => 1,
'edit' => true,
'unit' => 'px',
);
$h3_font_size_settings['mobile'] = 'generate_settings[mobile_heading_3_font_size]';
}
$wp_customize->add_control( $wp_customize->add_control(
new GeneratePress_Pro_Range_Slider_Control( new GeneratePress_Pro_Range_Slider_Control(
$wp_customize, $wp_customize,
@ -1625,18 +1661,8 @@ if ( ! function_exists( 'generate_fonts_customize_register' ) ) {
array( array(
'description' => __( 'Font size', 'gp-premium' ), 'description' => __( 'Font size', 'gp-premium' ),
'section' => 'font_content_section', 'section' => 'font_content_section',
'settings' => array( 'settings' => $h3_font_size_settings,
'desktop' => 'generate_settings[heading_3_font_size]', 'choices' => $h3_font_size_options,
),
'choices' => array(
'desktop' => array(
'min' => 10,
'max' => 80,
'step' => 1,
'edit' => true,
'unit' => 'px',
),
),
) )
) )
); );
@ -1785,6 +1811,42 @@ if ( ! function_exists( 'generate_fonts_customize_register' ) ) {
) )
); );
$h4_font_size_options = array(
'desktop' => array(
'min' => 10,
'max' => 80,
'step' => 1,
'edit' => true,
'unit' => 'px',
),
);
$h4_font_size_settings = array(
'desktop' => 'generate_settings[heading_4_font_size]',
);
if ( isset( $defaults['mobile_heading_4_font_size'] ) ) {
$wp_customize->add_setting(
'generate_settings[mobile_heading_4_font_size]',
array(
'default' => $defaults['mobile_heading_4_font_size'],
'type' => 'option',
'sanitize_callback' => 'generate_premium_sanitize_empty_absint',
'transport' => 'postMessage',
)
);
$h4_font_size_options['mobile'] = array(
'min' => 10,
'max' => 80,
'step' => 1,
'edit' => true,
'unit' => 'px',
);
$h4_font_size_settings['mobile'] = 'generate_settings[mobile_heading_4_font_size]';
}
$wp_customize->add_control( $wp_customize->add_control(
new GeneratePress_Pro_Range_Slider_Control( new GeneratePress_Pro_Range_Slider_Control(
$wp_customize, $wp_customize,
@ -1792,18 +1854,8 @@ if ( ! function_exists( 'generate_fonts_customize_register' ) ) {
array( array(
'description' => __( 'Font size', 'gp-premium' ), 'description' => __( 'Font size', 'gp-premium' ),
'section' => 'font_content_section', 'section' => 'font_content_section',
'settings' => array( 'settings' => $h4_font_size_settings,
'desktop' => 'generate_settings[heading_4_font_size]', 'choices' => $h4_font_size_options,
),
'choices' => array(
'desktop' => array(
'min' => 10,
'max' => 80,
'step' => 1,
'edit' => true,
'unit' => 'px',
),
),
) )
) )
); );
@ -1916,6 +1968,42 @@ if ( ! function_exists( 'generate_fonts_customize_register' ) ) {
) )
); );
$h5_font_size_options = array(
'desktop' => array(
'min' => 10,
'max' => 80,
'step' => 1,
'edit' => true,
'unit' => 'px',
),
);
$h5_font_size_settings = array(
'desktop' => 'generate_settings[heading_5_font_size]',
);
if ( isset( $defaults['mobile_heading_5_font_size'] ) ) {
$wp_customize->add_setting(
'generate_settings[mobile_heading_5_font_size]',
array(
'default' => $defaults['mobile_heading_5_font_size'],
'type' => 'option',
'sanitize_callback' => 'generate_premium_sanitize_empty_absint',
'transport' => 'postMessage',
)
);
$h5_font_size_options['mobile'] = array(
'min' => 10,
'max' => 80,
'step' => 1,
'edit' => true,
'unit' => 'px',
);
$h5_font_size_settings['mobile'] = 'generate_settings[mobile_heading_5_font_size]';
}
$wp_customize->add_control( $wp_customize->add_control(
new GeneratePress_Pro_Range_Slider_Control( new GeneratePress_Pro_Range_Slider_Control(
$wp_customize, $wp_customize,
@ -1923,18 +2011,8 @@ if ( ! function_exists( 'generate_fonts_customize_register' ) ) {
array( array(
'description' => __( 'Font size', 'gp-premium' ), 'description' => __( 'Font size', 'gp-premium' ),
'section' => 'font_content_section', 'section' => 'font_content_section',
'settings' => array( 'settings' => $h5_font_size_settings,
'desktop' => 'generate_settings[heading_5_font_size]', 'choices' => $h5_font_size_options,
),
'choices' => array(
'desktop' => array(
'min' => 10,
'max' => 80,
'step' => 1,
'edit' => true,
'unit' => 'px',
),
),
) )
) )
); );
@ -2944,7 +3022,7 @@ function generate_typography_get_premium_css() {
$premium_css->start_media_query( generate_premium_get_media_query( 'tablet' ) ); $premium_css->start_media_query( generate_premium_get_media_query( 'tablet' ) );
if ( '' !== $generate_settings['tablet_navigation_font_size'] ) { if ( '' !== $generate_settings['tablet_navigation_font_size'] ) {
$premium_css->set_selector( '.main-navigation:not(.slideout-navigation) a, .menu-toggle, .main-navigation .menu-bar-items' ); $premium_css->set_selector( '.main-navigation:not(.slideout-navigation) a, .main-navigation .menu-toggle, .main-navigation .menu-bar-items' );
$premium_css->add_property( 'font-size', absint( $generate_settings['tablet_navigation_font_size'] ), false, 'px' ); $premium_css->add_property( 'font-size', absint( $generate_settings['tablet_navigation_font_size'] ), false, 'px' );
$tablet_subnav_font_size = $generate_settings['tablet_navigation_font_size'] - 1; $tablet_subnav_font_size = $generate_settings['tablet_navigation_font_size'] - 1;
@ -2982,8 +3060,8 @@ function generate_typography_get_premium_css() {
$premium_css->start_media_query( generate_premium_get_media_query( 'mobile-menu' ) ); $premium_css->start_media_query( generate_premium_get_media_query( 'mobile-menu' ) );
if ( '' !== $generate_settings['mobile_navigation_font_size'] ) { if ( ! empty( $generate_settings['mobile_navigation_font_size'] ) ) {
$premium_css->set_selector( '.main-navigation:not(.slideout-navigation) a, .menu-toggle, .main-navigation .menu-bar-items' ); $premium_css->set_selector( '.main-navigation:not(.slideout-navigation) a, .main-navigation .menu-toggle, .main-navigation .menu-bar-items' );
$premium_css->add_property( 'font-size', absint( $generate_settings['mobile_navigation_font_size'] ), false, 'px' ); $premium_css->add_property( 'font-size', absint( $generate_settings['mobile_navigation_font_size'] ), false, 'px' );
$mobile_subnav_font_size = $generate_settings['mobile_navigation_font_size'] - 1; $mobile_subnav_font_size = $generate_settings['mobile_navigation_font_size'] - 1;
@ -3003,7 +3081,7 @@ function generate_typography_get_premium_css() {
); );
if ( $menu_settings['navigation_as_header'] || $menu_settings['sticky_navigation_logo'] || 'enable' === $menu_settings['mobile_header'] ) { if ( $menu_settings['navigation_as_header'] || $menu_settings['sticky_navigation_logo'] || 'enable' === $menu_settings['mobile_header'] ) {
if ( '' !== $generate_settings['mobile_site_title_font_size'] ) { if ( ! empty( $generate_settings['mobile_site_title_font_size'] ) ) {
$premium_css->set_selector( '.navigation-branding .main-title' ); $premium_css->set_selector( '.navigation-branding .main-title' );
$premium_css->add_property( 'font-size', absint( $generate_settings['mobile_site_title_font_size'] ), false, 'px' ); $premium_css->add_property( 'font-size', absint( $generate_settings['mobile_site_title_font_size'] ), false, 'px' );
} }

View File

@ -181,7 +181,8 @@ gp_premium_typography_live_update( 'archive_post_title_line_height', 'h2.entry-t
/** /**
* H3 font size, weight and transform * H3 font size, weight and transform
*/ */
gp_premium_typography_live_update( 'heading_3_font_size', 'h3', 'font-size', 'px' ); gp_premium_typography_live_update( 'heading_3_font_size', 'h3', 'font-size', 'px', gp_typography.desktop );
gp_premium_typography_live_update( 'mobile_heading_3_font_size', 'h3', 'font-size', 'px', gp_typography.mobile );
gp_premium_typography_live_update( 'heading_3_weight', 'h3', 'font-weight' ); gp_premium_typography_live_update( 'heading_3_weight', 'h3', 'font-weight' );
gp_premium_typography_live_update( 'heading_3_transform', 'h3', 'text-transform' ); gp_premium_typography_live_update( 'heading_3_transform', 'h3', 'text-transform' );
gp_premium_typography_live_update( 'heading_3_line_height', 'h3', 'line-height', 'em' ); gp_premium_typography_live_update( 'heading_3_line_height', 'h3', 'line-height', 'em' );
@ -190,7 +191,8 @@ gp_premium_typography_live_update( 'heading_3_margin_bottom', 'h3', 'margin-bott
/** /**
* H4 font size, weight and transform * H4 font size, weight and transform
*/ */
gp_premium_typography_live_update( 'heading_4_font_size', 'h4', 'font-size', 'px' ); gp_premium_typography_live_update( 'heading_4_font_size', 'h4', 'font-size', 'px', gp_typography.desktop );
gp_premium_typography_live_update( 'mobile_heading_4_font_size', 'h4', 'font-size', 'px', gp_typography.mobile );
gp_premium_typography_live_update( 'heading_4_weight', 'h4', 'font-weight' ); gp_premium_typography_live_update( 'heading_4_weight', 'h4', 'font-weight' );
gp_premium_typography_live_update( 'heading_4_transform', 'h4', 'text-transform' ); gp_premium_typography_live_update( 'heading_4_transform', 'h4', 'text-transform' );
gp_premium_typography_live_update( 'heading_4_line_height', 'h4', 'line-height', 'em' ); gp_premium_typography_live_update( 'heading_4_line_height', 'h4', 'line-height', 'em' );
@ -198,7 +200,8 @@ gp_premium_typography_live_update( 'heading_4_line_height', 'h4', 'line-height',
/** /**
* H5 font size, weight and transform * H5 font size, weight and transform
*/ */
gp_premium_typography_live_update( 'heading_5_font_size', 'h5', 'font-size', 'px' ); gp_premium_typography_live_update( 'heading_5_font_size', 'h5', 'font-size', 'px', gp_typography.desktop );
gp_premium_typography_live_update( 'mobile_heading_5_font_size', 'h5', 'font-size', 'px', gp_typography.mobile );
gp_premium_typography_live_update( 'heading_5_weight', 'h5', 'font-weight' ); gp_premium_typography_live_update( 'heading_5_weight', 'h5', 'font-weight' );
gp_premium_typography_live_update( 'heading_5_transform', 'h5', 'text-transform' ); gp_premium_typography_live_update( 'heading_5_transform', 'h5', 'text-transform' );
gp_premium_typography_live_update( 'heading_5_line_height', 'h5', 'line-height', 'em' ); gp_premium_typography_live_update( 'heading_5_line_height', 'h5', 'line-height', 'em' );

View File

@ -184,31 +184,26 @@
.wc-columns-container.wc-columns-6 .products, .wc-columns-container.wc-columns-6 .products,
.wc-related-upsell-columns-6 .related ul.products, .wc-related-upsell-columns-6 .related ul.products,
.wc-related-upsell-columns-6 .up-sells ul.products { .wc-related-upsell-columns-6 .up-sells ul.products {
-ms-grid-columns: 1fr 50px 1fr 50px 1fr 50px 1fr 50px 1fr 50px 1fr;
grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-columns: repeat(6, minmax(0, 1fr));
} }
.wc-columns-container.wc-columns-5 .products, .wc-columns-container.wc-columns-5 .products,
.wc-related-upsell-columns-5 .related ul.products, .wc-related-upsell-columns-5 .related ul.products,
.wc-related-upsell-columns-5 .up-sells ul.products { .wc-related-upsell-columns-5 .up-sells ul.products {
-ms-grid-columns: 1fr 50px 1fr 50px 1fr 50px 1fr 50px 1fr;
grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-columns: repeat(5, minmax(0, 1fr));
} }
.woocommerce .wc-columns-container.wc-columns-4 .products, .woocommerce .wc-columns-container.wc-columns-4 .products,
.wc-related-upsell-columns-4 .related ul.products, .wc-related-upsell-columns-4 .related ul.products,
.wc-related-upsell-columns-4 .up-sells ul.products { .wc-related-upsell-columns-4 .up-sells ul.products {
-ms-grid-columns: 1fr [4];
grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-columns: repeat(4, minmax(0, 1fr));
} }
.woocommerce .wc-columns-container.wc-columns-3 .products, .woocommerce .wc-columns-container.wc-columns-3 .products,
.wc-related-upsell-columns-3 .related ul.products, .wc-related-upsell-columns-3 .related ul.products,
.wc-related-upsell-columns-3 .up-sells ul.products { .wc-related-upsell-columns-3 .up-sells ul.products {
-ms-grid-columns: 1fr [3];
grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-columns: repeat(3, minmax(0, 1fr));
} }
.woocommerce .wc-columns-container.wc-columns-2 .products, .woocommerce .wc-columns-container.wc-columns-2 .products,
.wc-related-upsell-columns-2 .related ul.products, .wc-related-upsell-columns-2 .related ul.products,
.wc-related-upsell-columns-2 .up-sells ul.products { .wc-related-upsell-columns-2 .up-sells ul.products {
-ms-grid-columns: 1fr [2];
grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-columns: repeat(2, minmax(0, 1fr));
} }
.woocommerce .wc-columns-container.wc-columns-1 .products, .woocommerce .wc-columns-container.wc-columns-1 .products,
@ -743,6 +738,15 @@ nav span.count {
top: 0; top: 0;
} }
.wc-has-gallery picture.secondary-image {
width: 100%;
height: 100%;
}
.wc-product-image:hover .secondary-image {
opacity: 1;
}
.woocommerce ul.products li.product a img { .woocommerce ul.products li.product a img {
margin-bottom: 0; margin-bottom: 0;
} }

File diff suppressed because one or more lines are too long

View File

@ -203,7 +203,14 @@ function generatepress_wc_scripts() {
wp_enqueue_style( 'generate-woocommerce', plugin_dir_url( __FILE__ ) . "css/woocommerce{$suffix}.css", array(), GENERATE_WOOCOMMERCE_VERSION ); wp_enqueue_style( 'generate-woocommerce', plugin_dir_url( __FILE__ ) . "css/woocommerce{$suffix}.css", array(), GENERATE_WOOCOMMERCE_VERSION );
wp_enqueue_style( 'generate-woocommerce-mobile', plugin_dir_url( __FILE__ ) . "css/woocommerce-mobile{$suffix}.css", array(), GENERATE_WOOCOMMERCE_VERSION, generate_premium_get_media_query( 'mobile' ) ); wp_enqueue_style( 'generate-woocommerce-mobile', plugin_dir_url( __FILE__ ) . "css/woocommerce-mobile{$suffix}.css", array(), GENERATE_WOOCOMMERCE_VERSION, generate_premium_get_media_query( 'mobile' ) );
wp_enqueue_script( 'generate-woocommerce', plugin_dir_url( __FILE__ ) . "js/woocommerce{$suffix}.js", array( 'jquery' ), GENERATE_WOOCOMMERCE_VERSION, true ); if (
generatepress_wc_get_setting( 'cart_menu_item' ) ||
generatepress_wc_get_setting( 'off_canvas_panel_on_add_to_cart' ) ||
generatepress_wc_show_sticky_add_to_cart() ||
generatepress_wc_get_setting( 'quantity_buttons' )
) {
wp_enqueue_script( 'generate-woocommerce', plugin_dir_url( __FILE__ ) . "js/woocommerce{$suffix}.js", array( 'jquery' ), GENERATE_WOOCOMMERCE_VERSION, true );
}
$show_add_to_cart_panel = false; $show_add_to_cart_panel = false;

View File

@ -24,14 +24,6 @@ jQuery( document ).ready( function( $ ) {
}; };
}; };
$( '.wc-has-gallery .wc-product-image' ).hover(
function() {
$( this ).find( '.secondary-image' ).css( 'opacity','1' );
}, function() {
$( this ).find( '.secondary-image' ).css( 'opacity','0' );
}
);
$( 'body' ).on( 'added_to_cart', function() { $( 'body' ).on( 'added_to_cart', function() {
if ( ! $( '.wc-menu-item' ).hasClass( 'has-items' ) ) { if ( ! $( '.wc-menu-item' ).hasClass( 'has-items' ) ) {
$( '.wc-menu-item' ).addClass( 'has-items' ); $( '.wc-menu-item' ).addClass( 'has-items' );
@ -181,7 +173,7 @@ jQuery( document ).ready( function( $ ) {
} }
} ); } );
function generateQuantityButtons( quantitySelector ) { function generateQuantityButtons() {
var quantityBoxes, var quantityBoxes,
cart = $( '.woocommerce div.product form.cart' ); cart = $( '.woocommerce div.product form.cart' );
@ -190,95 +182,95 @@ jQuery( document ).ready( function( $ ) {
return; return;
} }
if ( ! quantitySelector ) { quantityBoxes = $( '.cart div.quantity:not(.buttons-added), .cart td.quantity:not(.buttons-added)' ).find( '.qty' );
quantitySelector = '.qty';
}
quantityBoxes = $( 'div.quantity:not(.buttons-added), td.quantity:not(.buttons-added)' ).find( quantitySelector ); if ( quantityBoxes ) {
$.each( quantityBoxes, function( key, value ) {
var box = $( value );
if ( quantityBoxes && 'date' !== quantityBoxes.prop( 'type' ) && 'hidden' !== quantityBoxes.prop( 'type' ) ) { if ( 'date' !== box.prop( 'type' ) && 'hidden' !== box.prop( 'type' ) ) {
// Add plus and minus icons
box.parent().addClass( 'buttons-added' ).prepend('<a href="javascript:void(0)" class="minus">-</a>');
box.after('<a href="javascript:void(0)" class="plus">+</a>');
// Add plus and minus icons // Target quantity inputs on product pages
quantityBoxes.parent().addClass( 'buttons-added' ).prepend('<a href="javascript:void(0)" class="minus">-</a>'); $( 'input.qty:not(.product-quantity input.qty)' ).each( function() {
quantityBoxes.after('<a href="javascript:void(0)" class="plus">+</a>'); var min = parseFloat( $( this ).attr( 'min' ) );
// Target quantity inputs on product pages if ( min && min > 0 && parseFloat( $( this ).val() ) < min ) {
$( 'input' + quantitySelector + ':not(.product-quantity input' + quantitySelector + ')' ).each( function() { $( this ).val( min );
var min = parseFloat( $( this ).attr( 'min' ) ); }
} );
if ( min && min > 0 && parseFloat( $( this ).val() ) < min ) { // Quantity input
$( this ).val( min ); if ( $( 'body' ).hasClass( 'single-product' ) && ! cart.hasClass( 'grouped_form' ) ) {
} var quantityInput = $( '.woocommerce form input[type=number].qty' );
});
// Quantity input quantityInput.on( 'keyup', function() {
if ( $( 'body' ).hasClass( 'single-product' ) && ! cart.hasClass( 'grouped_form' ) ) { var qty_val = $( this ).val();
var quantityInput = $( '.woocommerce form input[type=number].qty' ); quantityInput.val( qty_val );
quantityInput.on( 'keyup', function() { } );
var qty_val = $( this ).val();
quantityInput.val( qty_val );
});
}
$( '.plus, .minus' ).unbind( 'click' );
$( '.plus, .minus' ).on( 'click', function() {
// Quantity
var quantityBox;
// If floating bar is enabled
if ( $( 'body' ).hasClass( 'single-product' ) && ! cart.hasClass( 'grouped_form' ) && ! cart.hasClass( 'cart_group' ) ) {
quantityBox = $( '.plus, .minus' ).closest( '.quantity' ).find( quantitySelector );
} else {
quantityBox = $( this ).closest( '.quantity' ).find( quantitySelector );
}
// Get values
var currentQuantity = parseFloat( quantityBox.val() ),
maxQuantity = parseFloat( quantityBox.attr( 'max' ) ),
minQuantity = parseFloat( quantityBox.attr( 'min' ) ),
step = quantityBox.attr( 'step' );
// Fallback default values
if ( ! currentQuantity || '' === currentQuantity || 'NaN' === currentQuantity ) {
currentQuantity = 0;
}
if ( '' === maxQuantity || 'NaN' === maxQuantity ) {
maxQuantity = '';
}
if ( '' === minQuantity || 'NaN' === minQuantity ) {
minQuantity = 0;
}
if ( 'any' === step || '' === step || undefined === step || 'NaN' === parseFloat( step ) ) {
step = 1;
}
// Change the value
if ( $( this ).is( '.plus' ) ) {
if ( maxQuantity && ( maxQuantity == currentQuantity || currentQuantity > maxQuantity ) ) {
quantityBox.val( maxQuantity );
} else {
quantityBox.val( currentQuantity + parseFloat( step ) );
} }
} else { $( '.plus, .minus' ).unbind( 'click' );
if ( minQuantity && ( minQuantity == currentQuantity || currentQuantity < minQuantity ) ) { $( '.plus, .minus' ).on( 'click', function() {
quantityBox.val( minQuantity ); // Quantity
} else if ( currentQuantity > 0 ) { var quantityBox;
quantityBox.val( currentQuantity - parseFloat( step ) );
}
// If floating bar is enabled
if ( $( 'body' ).hasClass( 'single-product' ) && ! cart.hasClass( 'grouped_form' ) && ! cart.hasClass( 'cart_group' ) ) {
quantityBox = $( '.plus, .minus' ).closest( '.quantity' ).find( '.qty' );
} else {
quantityBox = $( this ).closest( '.quantity' ).find( '.qty' );
}
// Get values
var currentQuantity = parseFloat( quantityBox.val() ),
maxQuantity = parseFloat( quantityBox.attr( 'max' ) ),
minQuantity = parseFloat( quantityBox.attr( 'min' ) ),
step = quantityBox.attr( 'step' );
// Fallback default values
if ( ! currentQuantity || '' === currentQuantity || 'NaN' === currentQuantity ) {
currentQuantity = 0;
}
if ( '' === maxQuantity || 'NaN' === maxQuantity ) {
maxQuantity = '';
}
if ( '' === minQuantity || 'NaN' === minQuantity ) {
minQuantity = 0;
}
if ( 'any' === step || '' === step || undefined === step || 'NaN' === parseFloat( step ) ) {
step = 1;
}
// Change the value
if ( $( this ).is( '.plus' ) ) {
if ( maxQuantity && ( maxQuantity == currentQuantity || currentQuantity > maxQuantity ) ) {
quantityBox.val( maxQuantity );
} else {
quantityBox.val( currentQuantity + parseFloat( step ) );
}
} else {
if ( minQuantity && ( minQuantity == currentQuantity || currentQuantity < minQuantity ) ) {
quantityBox.val( minQuantity );
} else if ( currentQuantity > 0 ) {
quantityBox.val( currentQuantity - parseFloat( step ) );
}
}
// Trigger change event
quantityBox.trigger( 'change' );
} );
} }
// Trigger change event
quantityBox.trigger( 'change' );
} ); } );
} }
} }

View File

@ -1 +1 @@
jQuery(document).ready(function(l){var t=function(s,o,n){var r,i;return o||(o=250),function(){var t=n||this,a=+new Date,e=arguments;r&&a<r+o?(clearTimeout(i),i=setTimeout(function(){r=a,s.apply(t,e)},o)):(r=a,s.apply(t,e))}};if(l(".wc-has-gallery .wc-product-image").hover(function(){l(this).find(".secondary-image").css("opacity","1")},function(){l(this).find(".secondary-image").css("opacity","0")}),l("body").on("added_to_cart",function(){l(".wc-menu-item").hasClass("has-items")||l(".wc-menu-item").addClass("has-items"),l(".wc-mobile-cart-items").hasClass("has-items")||l(".wc-mobile-cart-items").addClass("has-items")}),l("body").on("removed_from_cart",function(){var t=l(".number-of-items");t.length&&t.hasClass("no-items")&&(l(".wc-menu-item").removeClass("has-items"),l(".wc-mobile-cart-items").removeClass("has-items"))}),generateWooCommerce.addToCartPanel&&(l(document.body).on("added_to_cart",function(){var t=l("#wpadminbar"),a=l(".navigation-stick"),e=0;t.length&&(e=t.outerHeight()),a.length&&"0px"===a.css("top")&&(e+=a.outerHeight()),l(".add-to-cart-panel").addClass("item-added").css({"-webkit-transform":"translateY("+e+"px)","-ms-transform":"translateY("+e+"px)",transform:"translateY("+e+"px)"})}),l(".add-to-cart-panel .continue-shopping").on("click",function(t){t.preventDefault(),l(".add-to-cart-panel").removeClass("item-added").css({"-webkit-transform":"translateY(-100%)","-ms-transform":"translateY(-100%)",transform:"translateY(-100%)"})}),l(window).on("scroll",t(function(){var t=l(".add-to-cart-panel");t.hasClass("item-added")&&t.removeClass("item-added").css({"-webkit-transform":"translateY(-100%)","-ms-transform":"translateY(-100%)",transform:"translateY(-100%)"})},250))),generateWooCommerce.stickyAddToCart){var m=0;l(window).on("scroll",t(function(){var t=l("#wpadminbar"),a=l(".navigation-stick"),e=0,s=l(window).scrollTop(),o=l(".add-to-cart-panel"),n=o.offset().top+o.outerHeight(),r=l(".single_add_to_cart_button"),i=r.offset().top,c=r.outerHeight(),d=l(".site-footer").offset().top;t.length&&(e=t.outerHeight()),a.length&&(a.hasClass("auto-hide-sticky")?(s<m&&"0px"===a.css("top")?e+=a.outerHeight():e=e,m=s):e+=a.outerHeight()),i+c<s&&n<d?o.addClass("show-sticky-add-to-cart").css({"-webkit-transform":"translateY("+e+"px)","-ms-transform":"translateY("+e+"px)",transform:"translateY("+e+"px)"}):o.removeClass("show-sticky-add-to-cart").css({"-webkit-transform":"","-ms-transform":"",transform:""})},250)),l(".go-to-variables").on("click",function(t){t.preventDefault();var a=0,e=l(".navigation-stick"),s=l("#wpadminbar");e.length&&(a=e.outerHeight()),s.length&&(a+=s.outerHeight()),l("html, body").animate({scrollTop:l(".variations").offset().top-a},250)})}function a(n){var t,r=l(".woocommerce div.product form.cart");if(r.closest(".elementor-add-to-cart").length)l(".elementor.product").removeClass("do-quantity-buttons");else if(n||(n=".qty"),(t=l("div.quantity:not(.buttons-added), td.quantity:not(.buttons-added)").find(n))&&"date"!==t.prop("type")&&"hidden"!==t.prop("type")){if(t.parent().addClass("buttons-added").prepend('<a href="javascript:void(0)" class="minus">-</a>'),t.after('<a href="javascript:void(0)" class="plus">+</a>'),l("input"+n+":not(.product-quantity input"+n+")").each(function(){var t=parseFloat(l(this).attr("min"));t&&0<t&&parseFloat(l(this).val())<t&&l(this).val(t)}),l("body").hasClass("single-product")&&!r.hasClass("grouped_form")){var a=l(".woocommerce form input[type=number].qty");a.on("keyup",function(){var t=l(this).val();a.val(t)})}l(".plus, .minus").unbind("click"),l(".plus, .minus").on("click",function(){var t;t=!l("body").hasClass("single-product")||r.hasClass("grouped_form")||r.hasClass("cart_group")?l(this).closest(".quantity").find(n):l(".plus, .minus").closest(".quantity").find(n);var a=parseFloat(t.val()),e=parseFloat(t.attr("max")),s=parseFloat(t.attr("min")),o=t.attr("step");a&&""!==a&&"NaN"!==a||(a=0),""!==e&&"NaN"!==e||(e=""),""!==s&&"NaN"!==s||(s=0),"any"!==o&&""!==o&&void 0!==o&&"NaN"!==parseFloat(o)||(o=1),l(this).is(".plus")?e&&(e==a||e<a)?t.val(e):t.val(a+parseFloat(o)):s&&(s==a||a<s)?t.val(s):0<a&&t.val(a-parseFloat(o)),t.trigger("change")})}}l(document).on("ready",function(){"use strict";generateWooCommerce.quantityButtons&&a()}),l(document).ajaxComplete(function(){"use strict";generateWooCommerce.quantityButtons&&a()})}); jQuery(document).ready(function(c){function t(s,o,n){var r,i;return o=o||250,function(){var t=n||this,a=+new Date,e=arguments;r&&a<r+o?(clearTimeout(i),i=setTimeout(function(){r=a,s.apply(t,e)},o)):(r=a,s.apply(t,e))}}var m;function a(){var t,n=c(".woocommerce div.product form.cart");n.closest(".elementor-add-to-cart").length?c(".elementor.product").removeClass("do-quantity-buttons"):(t=c(".cart div.quantity:not(.buttons-added), .cart td.quantity:not(.buttons-added)").find(".qty"))&&c.each(t,function(t,a){var e,s=c(a);"date"!==s.prop("type")&&"hidden"!==s.prop("type")&&(s.parent().addClass("buttons-added").prepend('<a href="javascript:void(0)" class="minus">-</a>'),s.after('<a href="javascript:void(0)" class="plus">+</a>'),c("input.qty:not(.product-quantity input.qty)").each(function(){var t=parseFloat(c(this).attr("min"));t&&0<t&&parseFloat(c(this).val())<t&&c(this).val(t)}),c("body").hasClass("single-product")&&!n.hasClass("grouped_form")&&(e=c(".woocommerce form input[type=number].qty")).on("keyup",function(){var t=c(this).val();e.val(t)}),c(".plus, .minus").unbind("click"),c(".plus, .minus").on("click",function(){var t=!c("body").hasClass("single-product")||n.hasClass("grouped_form")||n.hasClass("cart_group")?c(this).closest(".quantity").find(".qty"):c(".plus, .minus").closest(".quantity").find(".qty"),a=parseFloat(t.val()),e=parseFloat(t.attr("max")),s=parseFloat(t.attr("min")),o=t.attr("step");a&&""!==a&&"NaN"!==a||(a=0),""!==e&&"NaN"!==e||(e=""),""!==s&&"NaN"!==s||(s=0),"any"!==o&&""!==o&&void 0!==o&&"NaN"!==parseFloat(o)||(o=1),c(this).is(".plus")?e&&(e==a||e<a)?t.val(e):t.val(a+parseFloat(o)):s&&(s==a||a<s)?t.val(s):0<a&&t.val(a-parseFloat(o)),t.trigger("change")}))})}c("body").on("added_to_cart",function(){c(".wc-menu-item").hasClass("has-items")||c(".wc-menu-item").addClass("has-items"),c(".wc-mobile-cart-items").hasClass("has-items")||c(".wc-mobile-cart-items").addClass("has-items")}),c("body").on("removed_from_cart",function(){var t=c(".number-of-items");t.length&&t.hasClass("no-items")&&(c(".wc-menu-item").removeClass("has-items"),c(".wc-mobile-cart-items").removeClass("has-items"))}),generateWooCommerce.addToCartPanel&&(c(document.body).on("added_to_cart",function(){var t=c("#wpadminbar"),a=c(".navigation-stick"),e=0;t.length&&(e=t.outerHeight()),a.length&&"0px"===a.css("top")&&(e+=a.outerHeight()),c(".add-to-cart-panel").addClass("item-added").css({"-webkit-transform":"translateY("+e+"px)","-ms-transform":"translateY("+e+"px)",transform:"translateY("+e+"px)"})}),c(".add-to-cart-panel .continue-shopping").on("click",function(t){t.preventDefault(),c(".add-to-cart-panel").removeClass("item-added").css({"-webkit-transform":"translateY(-100%)","-ms-transform":"translateY(-100%)",transform:"translateY(-100%)"})}),c(window).on("scroll",t(function(){var t=c(".add-to-cart-panel");t.hasClass("item-added")&&t.removeClass("item-added").css({"-webkit-transform":"translateY(-100%)","-ms-transform":"translateY(-100%)",transform:"translateY(-100%)"})},250))),generateWooCommerce.stickyAddToCart&&(m=0,c(window).on("scroll",t(function(){var t=c("#wpadminbar"),a=c(".navigation-stick"),e=0,s=c(window).scrollTop(),o=c(".add-to-cart-panel"),n=o.offset().top+o.outerHeight(),r=c(".single_add_to_cart_button"),i=r.offset().top,l=r.outerHeight(),d=c(".site-footer").offset().top;t.length&&(e=t.outerHeight()),a.length&&(a.hasClass("auto-hide-sticky")?(s<m&&"0px"===a.css("top")&&(e+=a.outerHeight()),m=s):e+=a.outerHeight()),i+l<s&&n<d?o.addClass("show-sticky-add-to-cart").css({"-webkit-transform":"translateY("+e+"px)","-ms-transform":"translateY("+e+"px)",transform:"translateY("+e+"px)"}):o.removeClass("show-sticky-add-to-cart").css({"-webkit-transform":"","-ms-transform":"",transform:""})},250)),c(".go-to-variables").on("click",function(t){t.preventDefault();var a=0,e=c(".navigation-stick"),s=c("#wpadminbar");e.length&&(a=e.outerHeight()),s.length&&(a+=s.outerHeight()),c("html, body").animate({scrollTop:c(".variations").offset().top-a},250)})),c(document).on("ready",function(){"use strict";generateWooCommerce.quantityButtons&&a()}),c(document).ajaxComplete(function(){"use strict";generateWooCommerce.quantityButtons&&a()})});