updated plugin GP Premium version 2.3.0

This commit is contained in:
2023-03-29 18:20:22 +00:00
committed by Gitium
parent e42ba0e05a
commit 16a556be53
40 changed files with 539 additions and 172 deletions

View File

@ -3,12 +3,23 @@ jQuery( function( $ ) {
e.preventDefault();
$( '.choose-element-type-parent' ).show();
$( '.choose-element-type .select-type' ).focus();
} );
$( '.close-choose-element-type' ).on( 'click', function( e ) {
e.preventDefault();
$( '.choose-element-type-parent' ).hide();
$( '.page-title-action' ).focus();
} );
$( '.post-type-gp_elements' ).on( 'keyup', function( e ) {
const $element = $( '.choose-element-type-parent' );
if ( e.key === 'Escape' && $element.is( ':visible' ) ) {
$element.hide();
$( '.page-title-action' ).focus();
}
} );
// Don't allow Elements to quick edit parents.

View File

@ -78,8 +78,11 @@ class GeneratePress_Block_Elements {
wp_set_script_translations( 'gp-premium-block-elements', 'gp-premium', GP_PREMIUM_DIR_PATH . 'langs' );
$taxonomies = get_taxonomies(
array(
'public' => true,
apply_filters(
'generate_get_block_element_taxonomies_args',
array(
'public' => true,
)
)
);
@ -310,7 +313,13 @@ class GeneratePress_Block_Elements {
* Build our content block.
*/
public function do_content_block() {
if ( 'gp_elements' !== get_post_type() && ! is_admin() ) {
// Prevents infinite loops while in the editor or autosaving.
$nonpublic_post_types = array(
'gp_elements',
'revision',
);
if ( ! in_array( get_post_type(), $nonpublic_post_types ) && ! is_admin() ) {
return sprintf(
'<div class="dynamic-entry-content">%s</div>',
apply_filters( 'the_content', str_replace( ']]>', ']]&gt;', get_the_content() ) ) // phpcs:ignore -- Core filter.
@ -755,6 +764,10 @@ class GeneratePress_Block_Elements {
$post_title = post_type_archive_title( '', false );
} elseif ( is_archive() && function_exists( 'get_the_archive_title' ) ) {
$post_title = get_the_archive_title();
if ( is_author() ) {
$post_title = get_the_author();
}
} elseif ( is_home() ) {
$page_for_posts = get_option( 'page_for_posts' );
@ -1303,7 +1316,13 @@ class GeneratePress_Block_Elements {
public function set_dynamic_container_url( $attributes, $settings ) {
$link_type = ! empty( $settings['gpDynamicLinkType'] ) ? $settings['gpDynamicLinkType'] : '';
if ( $link_type && '' !== $settings['url'] && ( 'wrapper' === $settings['linkType'] || 'hidden-link' === $settings['linkType'] ) ) {
if (
$link_type &&
isset( $settings['url'] ) &&
isset( $settings['linkType'] ) &&
'' !== $settings['url'] &&
( 'wrapper' === $settings['linkType'] || 'hidden-link' === $settings['linkType'] )
) {
if ( ! empty( $link_type ) ) {
$source = ! empty( $settings['gpDynamicSource'] ) ? $settings['gpDynamicSource'] : 'current-post';
$id = $this->get_source_id( $source, $settings );

View File

@ -132,6 +132,10 @@ class GeneratePress_Block_Element {
case 'loop-template':
$hook = 'generate_before_main_content';
break;
case 'search-modal':
$hook = 'generate_inside_search_modal';
break;
}
if ( 'custom' === $hook && $custom_hook ) {
@ -181,6 +185,10 @@ class GeneratePress_Block_Element {
add_filter( 'post_class', array( $this, 'post_classes' ) );
}
if ( 'search-modal' === $this->type ) {
remove_action( 'generate_inside_search_modal', 'generate_do_search_fields' );
}
add_action( 'wp', array( $this, 'remove_elements' ), 100 );
add_action( esc_attr( $hook ), array( $this, 'build_hook' ), absint( $priority ) );
add_filter( 'generateblocks_do_content', array( $this, 'do_block_content' ) );
@ -291,6 +299,7 @@ class GeneratePress_Block_Element {
}
remove_action( 'generate_archive_title', 'generate_archive_title' );
remove_filter( 'get_the_archive_title', 'generate_filter_the_archive_title' );
// WooCommerce removal.
if ( class_exists( 'WooCommerce' ) ) {

View File

@ -194,6 +194,10 @@ class GeneratePress_Elements_Helper {
$label = __( 'Content Template', 'gp-premium' );
break;
case 'loop-template':
$label = __( 'Loop Template', 'gp-premium' );
break;
case 'post-meta-template':
$label = __( 'Post Meta Template', 'gp-premium' );
break;

View File

@ -890,6 +890,7 @@ class GeneratePress_Hero {
}
remove_action( 'generate_archive_title', 'generate_archive_title' );
remove_filter( 'get_the_archive_title', 'generate_filter_the_archive_title' );
add_filter( 'post_class', array( self::$hero, 'remove_hentry' ) );
}
@ -935,6 +936,10 @@ class GeneratePress_Hero {
$post_title = post_type_archive_title( '', false );
} elseif ( is_archive() && function_exists( 'get_the_archive_title' ) ) {
$post_title = get_the_archive_title();
if ( is_author() ) {
$post_title = get_the_author();
}
} elseif ( is_home() ) {
$post_title = __( 'Blog', 'gp-premium' );
}

View File

@ -241,6 +241,7 @@ class GeneratePress_Elements_Post_Type {
'site-header',
'page-hero',
'content-template',
'loop-template',
'post-meta-template',
'post-navigation-template',
'archive-navigation-template',