updated plugin GP Premium
version 2.2.0
This commit is contained in:
@ -128,6 +128,10 @@ class GeneratePress_Block_Element {
|
||||
case 'content-template':
|
||||
$hook = 'generate_before_do_template_part';
|
||||
break;
|
||||
|
||||
case 'loop-template':
|
||||
$hook = 'generate_before_main_content';
|
||||
break;
|
||||
}
|
||||
|
||||
if ( 'custom' === $hook && $custom_hook ) {
|
||||
@ -170,6 +174,13 @@ class GeneratePress_Block_Element {
|
||||
add_filter( 'generate_do_template_part', array( $this, 'do_template_part' ) );
|
||||
}
|
||||
|
||||
if ( 'loop-template' === $this->type ) {
|
||||
add_filter( 'generate_has_default_loop', '__return_false' );
|
||||
add_filter( 'generate_blog_columns', '__return_false' );
|
||||
add_filter( 'option_generate_blog_settings', array( $this, 'filter_blog_settings' ) );
|
||||
add_filter( 'post_class', array( $this, 'post_classes' ) );
|
||||
}
|
||||
|
||||
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' ) );
|
||||
@ -231,6 +242,33 @@ class GeneratePress_Block_Element {
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter some of our blog settings.
|
||||
*
|
||||
* @param array $settings Existing blog settings.
|
||||
*/
|
||||
public function filter_blog_settings( $settings ) {
|
||||
if ( 'loop-template' === $this->type ) {
|
||||
$settings['infinite_scroll'] = false;
|
||||
$settings['read_more_button'] = false;
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add class to our loop template item posts.
|
||||
*
|
||||
* @param array $classes Post classes.
|
||||
*/
|
||||
public function post_classes( $classes ) {
|
||||
if ( 'loop-template' === $this->type && is_main_query() ) {
|
||||
$classes[] = 'is-loop-template-item';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove existing elements.
|
||||
*
|
||||
|
Reference in New Issue
Block a user