updated plugin GP Premium version 2.0.3

This commit is contained in:
2021-07-25 23:25:02 +00:00
committed by Gitium
parent d7964b08bd
commit 3ef36355e9
154 changed files with 6153 additions and 9541 deletions

View File

@ -27,13 +27,13 @@ if ( ! function_exists( 'generate_blog_scripts' ) ) {
$deps = array();
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
$deps[] = 'jquery-masonry';
$deps[] = 'masonry';
$deps[] = 'imagesloaded';
}
if ( $settings[ 'infinite_scroll' ] && ! is_singular() && ! is_404() ) {
$deps[] = 'infinitescroll';
wp_enqueue_script( 'infinitescroll', plugin_dir_url( __FILE__ ) . 'js/infinite-scroll.pkgd.min.js', array( 'jquery' ), '3.0.1', true );
if ( $settings[ 'infinite_scroll' ] && ! is_singular() && ! is_404() && ! is_post_type_archive( 'product' ) ) {
$deps[] = 'infinite-scroll';
wp_enqueue_script( 'infinite-scroll', plugin_dir_url( __FILE__ ) . 'js/infinite-scroll.pkgd.min.js', array(), '3.0.6', true );
$font_icons = true;
@ -48,7 +48,7 @@ if ( ! function_exists( 'generate_blog_scripts' ) ) {
}
}
if ( ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) || ( $settings[ 'infinite_scroll' ] && ! is_singular() && ! is_404() ) ) {
if ( ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) || ( $settings[ 'infinite_scroll' ] && ! is_singular() && ! is_404() && ! is_post_type_archive( 'product' ) ) ) {
wp_enqueue_script( 'generate-blog', plugin_dir_url( __FILE__ ) . "js/scripts{$suffix}.js", $deps, GENERATE_BLOG_VERSION, true );
wp_localize_script(
@ -62,7 +62,7 @@ if ( ! function_exists( 'generate_blog_scripts' ) ) {
'generate_blog_masonry_init',
array(
'columnWidth' => '.grid-sizer',
'itemSelector' => 'none',
'itemSelector' => '.masonry-post',
'stamp' => '.page-header',
'percentPosition' => true,
'stagger' => 30,
@ -79,8 +79,8 @@ if ( ! function_exists( 'generate_blog_scripts' ) ) {
'infiniteScrollInit' => apply_filters(
'generate_blog_infinite_scroll_init',
array(
'path' => '.nav-links .next',
'append' => '#main article',
'path' => '.infinite-scroll-path a',
'append' => '#main .infinite-scroll-item',
'history' => false,
'loadOnScroll' => $settings['infinite_scroll_button'] ? false : true,
'button' => $settings['infinite_scroll_button'] ? '.load-more a' : null,
@ -144,6 +144,10 @@ if ( ! function_exists( 'generate_blog_post_classes' ) ) {
generate_blog_get_defaults()
);
if ( $settings['infinite_scroll'] ) {
$classes[] = 'infinite-scroll-item';
}
// Set our masonry class
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
$classes[] = 'masonry-post';
@ -594,7 +598,7 @@ add_filter( 'generate_content_more_link_output', 'generate_blog_read_more_button
*
* @since 1.5
*
* @param string Our existing read more link.
* @param string $output Our existing read more link.
*/
function generate_blog_read_more_button( $output ) {
$settings = wp_parse_args(
@ -602,16 +606,21 @@ function generate_blog_read_more_button( $output ) {
generate_blog_get_defaults()
);
if ( ! $settings[ 'read_more_button' ] ) {
if ( ! $settings['read_more_button'] ) {
return $output;
}
return sprintf( '%5$s<p class="read-more-container"><a title="%1$s" class="read-more button" href="%2$s">%3$s%4$s</a></p>',
return sprintf(
'%5$s<p class="read-more-container"><a title="%1$s" class="read-more button" href="%2$s" aria-label="%4$s">%3$s</a></p>',
the_title_attribute( 'echo=0' ),
esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump','#more-' . get_the_ID() ) ),
esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump', '#more-' . get_the_ID() ) ),
wp_kses_post( $settings['read_more'] ),
'<span class="screen-reader-text">' . get_the_title() . '</span>',
'generate_excerpt_more_output' == current_filter() ? ' ... ' : ''
sprintf(
/* translators: Aria-label describing the read more button */
_x( 'More on %s', 'more on post title', 'gp-premium' ),
the_title_attribute( 'echo=0' )
),
'generate_excerpt_more_output' === current_filter() ? ' ... ' : ''
);
}
@ -675,3 +684,27 @@ function generate_blog_get_singular_template() {
return $template;
}
add_action( 'generate_after_footer', 'generate_blog_do_infinite_scroll_path', 500 );
/**
* Add a next page of posts link for infinite scroll.
*
* @since 2.0.0
*/
function generate_blog_do_infinite_scroll_path() {
if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
return;
}
$settings = wp_parse_args(
get_option( 'generate_blog_settings', array() ),
generate_blog_get_defaults()
);
if ( $settings['infinite_scroll'] && ! is_singular() && ! is_404() ) {
printf(
'<div class="infinite-scroll-path" aria-hidden="true" style="display: none;">%s</div>',
get_next_posts_link()
);
}
}