updated plugin GP Premium
version 1.11.2
This commit is contained in:
@ -1,5 +1,13 @@
|
||||
<?php
|
||||
defined( 'WPINC' ) or die;
|
||||
/**
|
||||
* This file handles column-related functionality.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_blog_get_columns' ) ) {
|
||||
/**
|
||||
@ -13,33 +21,36 @@ if ( ! function_exists( 'generate_blog_get_columns' ) ) {
|
||||
generate_blog_get_defaults()
|
||||
);
|
||||
|
||||
// If columns are enabled, set to true
|
||||
$columns = ( true == $generate_blog_settings['column_layout'] ) ? true : false;
|
||||
// If columns are enabled, set to true.
|
||||
$columns = ( $generate_blog_settings['column_layout'] ) ? true : false;
|
||||
|
||||
// If we're not dealing with posts, set it to false.
|
||||
// Check for is_home() to prevent bug in Yoast that throws off the post type check.
|
||||
$columns = ( 'post' == get_post_type() || is_search() || is_home() ) ? $columns : false;
|
||||
$columns = ( 'post' === get_post_type() || is_search() || is_home() ) ? $columns : false;
|
||||
|
||||
// If masonry is enabled via filter, enable columns
|
||||
// If masonry is enabled via filter, enable columns.
|
||||
// phpcs:ignore -- Non-strict comparison allowed.
|
||||
$columns = ( 'true' == apply_filters( 'generate_blog_masonry', 'false' ) ) ? true : $columns;
|
||||
|
||||
// If we're on a singular post or page, disable
|
||||
// If we're on a singular post or page, disable.
|
||||
$columns = ( is_singular() ) ? false : $columns;
|
||||
|
||||
// Turn off columns if we're on a WooCommerce search page
|
||||
// Turn off columns if we're on a WooCommerce search page.
|
||||
if ( function_exists( 'is_woocommerce' ) ) {
|
||||
$columns = ( is_woocommerce() && is_search() ) ? false : $columns;
|
||||
}
|
||||
|
||||
// Bail if there's no search results
|
||||
// Bail if there's no search results.
|
||||
if ( is_search() ) {
|
||||
global $wp_query;
|
||||
|
||||
// phpcs:ignore -- non-strict comparison allowed.
|
||||
if ( 0 == $wp_query->post_count ) {
|
||||
$columns = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Return the result
|
||||
// Return the result.
|
||||
return apply_filters( 'generate_blog_columns', $columns );
|
||||
}
|
||||
}
|
||||
@ -56,6 +67,7 @@ if ( ! function_exists( 'generate_blog_get_masonry' ) ) {
|
||||
);
|
||||
|
||||
// If masonry is enabled via option or filter, enable it.
|
||||
// phpcs:ignore -- non-strict comparison allowed.
|
||||
if ( $generate_blog_settings['masonry'] || 'true' == apply_filters( 'generate_blog_masonry', 'false' ) ) {
|
||||
$masonry = 'true';
|
||||
} else {
|
||||
@ -88,7 +100,7 @@ if ( ! function_exists( 'generate_blog_add_columns_container' ) ) {
|
||||
printf(
|
||||
'<div class="generate-columns-container %1$s">%2$s',
|
||||
'false' !== generate_blog_get_masonry() ? 'masonry-container are-images-unloaded' : '',
|
||||
'false' !== generate_blog_get_masonry() ? '<div class="grid-sizer ' . esc_attr( 'grid-' . esc_attr( $columns ) ) . ' tablet-grid-50 mobile-grid-100"></div>' : ''
|
||||
'false' !== generate_blog_get_masonry() ? '<div class="grid-sizer grid-' . esc_attr( $columns ) . ' tablet-grid-50 mobile-grid-100"></div>' : '' // phpcs:ignore -- no escaping needed.
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -126,7 +138,7 @@ if ( ! function_exists( 'generate_blog_columns_css' ) ) {
|
||||
);
|
||||
}
|
||||
|
||||
$separator = ( function_exists('generate_spacing_get_defaults') ) ? absint( $spacing_settings['separator'] ) : 20;
|
||||
$separator = ( function_exists( 'generate_spacing_get_defaults' ) ) ? absint( $spacing_settings['separator'] ) : 20;
|
||||
|
||||
$return = '';
|
||||
if ( generate_blog_get_columns() ) {
|
||||
|
Reference in New Issue
Block a user