updated theme GeneratePress version 3.2.0

This commit is contained in:
2022-10-27 11:14:10 +00:00
committed by Gitium
parent 7b1024e711
commit 1465186bc5
41 changed files with 3367 additions and 4581 deletions

View File

@ -75,6 +75,7 @@ class GeneratePress_Typography {
$variants = apply_filters( 'generate_google_font_variants', $variants, $font['fontFamily'] );
$name = str_replace( ' ', '+', $font['fontFamily'] );
$name = str_replace( '"', '', $name );
if ( $variants ) {
$data[] = $name . ':' . implode( ',', $variants );
@ -118,9 +119,8 @@ class GeneratePress_Typography {
* Build our typography CSS.
*
* @param string $module The name of the module we're generating CSS for.
* @param string $type Either frontend or editor.
*/
public static function get_css( $module = 'core', $type = 'frontend' ) {
public static function get_css( $module = 'core' ) {
$typography = generate_get_option( 'typography' );
// Get data for a specific module so CSS can be compiled separately.
@ -137,18 +137,13 @@ class GeneratePress_Typography {
$body_selector = 'body';
$paragraph_selector = 'p';
if ( 'editor' === $type ) {
$body_selector = 'html .editor-styles-wrapper';
$paragraph_selector = 'html .editor-styles-wrapper p';
}
foreach ( $typography as $key => $data ) {
$options = wp_parse_args(
$data,
self::get_defaults()
);
$selector = self::get_css_selector( $options['selector'], $type );
$selector = self::get_css_selector( $options['selector'] );
if ( 'custom' === $selector ) {
$selector = $options['customSelector'];
@ -160,6 +155,8 @@ class GeneratePress_Typography {
$css->add_property( 'font-family', $font_family );
$css->add_property( 'font-weight', $options['fontWeight'] );
$css->add_property( 'text-transform', $options['textTransform'] );
$css->add_property( 'font-style', $options['fontStyle'] );
$css->add_property( 'text-decoration', $options['textDecoration'] );
$css->add_property( 'font-size', $options['fontSize'], false, $options['fontSizeUnit'] );
$css->add_property( 'letter-spacing', $options['letterSpacing'], false, $options['letterSpacingUnit'] );
@ -221,98 +218,63 @@ class GeneratePress_Typography {
* Get the CSS selector.
*
* @param string $selector The saved selector to look up.
* @param string $type Whether we're getting the selectors for the frontend or editor.
*/
public static function get_css_selector( $selector, $type ) {
if ( 'frontend' === $type ) {
switch ( $selector ) {
case 'body':
$selector = 'body, button, input, select, textarea';
break;
public static function get_css_selector( $selector ) {
switch ( $selector ) {
case 'body':
$selector = 'body, button, input, select, textarea';
break;
case 'main-title':
$selector = '.main-title';
break;
case 'main-title':
$selector = '.main-title';
break;
case 'site-description':
$selector = '.site-description';
break;
case 'site-description':
$selector = '.site-description';
break;
case 'primary-menu-items':
$selector = '.main-navigation a, .main-navigation .menu-toggle, .main-navigation .menu-bar-items';
break;
case 'primary-menu-items':
$selector = '.main-navigation a, .main-navigation .menu-toggle, .main-navigation .menu-bar-items';
break;
case 'primary-sub-menu-items':
$selector = '.main-navigation .main-nav ul ul li a';
break;
case 'primary-sub-menu-items':
$selector = '.main-navigation .main-nav ul ul li a';
break;
case 'primary-menu-toggle':
$selector = '.main-navigation .menu-toggle';
break;
case 'primary-menu-toggle':
$selector = '.main-navigation .menu-toggle';
break;
case 'buttons':
$selector = 'button:not(.menu-toggle),html input[type="button"],input[type="reset"],input[type="submit"],.button,.wp-block-button .wp-block-button__link';
break;
case 'buttons':
$selector = 'button:not(.menu-toggle),html input[type="button"],input[type="reset"],input[type="submit"],.button,.wp-block-button .wp-block-button__link';
break;
case 'all-headings':
$selector = 'h1, h2, h3, h4, h5, h6';
break;
case 'all-headings':
$selector = 'h1, h2, h3, h4, h5, h6';
break;
case 'single-content-title':
$selector = 'h1.entry-title';
break;
case 'single-content-title':
$selector = 'h1.entry-title';
break;
case 'archive-content-title':
$selector = 'h2.entry-title';
break;
case 'archive-content-title':
$selector = 'h2.entry-title';
break;
case 'top-bar':
$selector = '.top-bar';
break;
case 'top-bar':
$selector = '.top-bar';
break;
case 'widget-titles':
$selector = '.widget-title';
break;
case 'widget-titles':
$selector = '.widget-title';
break;
case 'footer':
$selector = '.site-info';
break;
}
case 'footer':
$selector = '.site-info';
break;
}
if ( 'editor' === $type ) {
switch ( $selector ) {
case 'body':
$selector = 'html .editor-styles-wrapper';
break;
case 'buttons':
$selector = '.editor-styles-wrapper a.button, .block-editor-block-list__layout .wp-block-button .wp-block-button__link';
break;
case 'all-headings':
$selector = 'html .editor-styles-wrapper h1, html .editor-styles-wrapper h2, html .editor-styles-wrapper h3, html .editor-styles-wrapper h4, html .editor-styles-wrapper h5, html .editor-styles-wrapper h6';
break;
case 'h1':
$selector = 'html .editor-styles-wrapper h1, html .editor-styles-wrapper .editor-post-title__input';
break;
case 'single-content-title':
$selector = 'html .editor-styles-wrapper .editor-post-title__input';
break;
case 'h2':
case 'h3':
case 'h4':
case 'h5':
case 'h6':
$selector = 'html .editor-styles-wrapper ' . $selector;
break;
}
}
return apply_filters( 'generate_typography_css_selector', $selector, $type );
return apply_filters( 'generate_typography_css_selector', $selector );
}
/**
@ -338,6 +300,11 @@ class GeneratePress_Typography {
}
if ( ! empty( $font_family_args['googleFont'] ) && ! empty( $font_family_args['googleFontCategory'] ) ) {
// Add quotations around font names with standalone numbers.
if ( preg_match( '/(?<!\S)\d+(?!\S)/', $font_family ) ) {
$font_family = '"' . $font_family . '"';
}
$font_family = $font_family . ', ' . $font_family_args['googleFontCategory'];
} elseif ( 'System Default' === $font_family ) {
$font_family = generate_get_system_default_font();
@ -355,6 +322,8 @@ class GeneratePress_Typography {
'fontFamily' => '',
'fontWeight' => '',
'textTransform' => '',
'textDecoration' => '',
'fontStyle' => '',
'fontSize' => '',
'fontSizeTablet' => '',
'fontSizeMobile' => '',