Support argument image_size="false"

Support argument image_size="false" to disable image
This commit is contained in:
2020-10-02 23:07:35 +07:00
committed by GitHub
parent 7742683dad
commit b52d6a871b
+12 -8
View File
@@ -467,21 +467,25 @@ if ( ! class_exists( 'Display_Posts_Remote' ) ) {
$imageAttributes = $self->getImageAttributes( $atts ); $imageAttributes = $self->getImageAttributes( $atts );
if ( $atts['image_size'] && $post->has_post_thumbnail() && $atts['include_link'] ) { if( $atts['image_size'] && false !== filter_var( $atts['image_size'], FILTER_VALIDATE_BOOLEAN ) ) {
$image = '<a class="image" href="' . esc_url( $post->get_permalink() ) . '">' . $post->get_the_post_thumbnail( $atts['image_size'], $imageAttributes ) . '</a> '; if ( $post->has_post_thumbnail() && $atts['include_link'] ) {
} elseif ( $atts['image_size'] && $post->has_post_thumbnail() ) { $image = '<a class="image" href="' . esc_url( $post->get_permalink() ) . '">' . $post->get_the_post_thumbnail( $atts['image_size'], $imageAttributes ) . '</a> ';
$image = '<span class="image">' . $post->get_the_post_thumbnail( $atts['image_size'], $imageAttributes ) . '</span> '; } elseif ( $post->has_post_thumbnail() ) {
} elseif ( $post->has_featured_media() && $atts['include_link'] ) { $image = '<span class="image">' . $post->get_the_post_thumbnail( $atts['image_size'], $imageAttributes ) . '</span> ';
$image = '<a class="image" href="' . esc_url( $post->get_permalink() ) . '">' . $post->get_the_post_thumbnail( 'full', $imageAttributes ) . '</a> '; } elseif ( $post->has_featured_media() && $atts['include_link'] ) {
} elseif ( $post->has_featured_media() ) { $image = '<a class="image" href="' . esc_url( $post->get_permalink() ) . '">' . $post->get_the_post_thumbnail( 'full', $imageAttributes ) . '</a> ';
$image = '<span class="image">' . $post->get_the_post_thumbnail( 'full', $imageAttributes ) . '</span> '; } elseif ( $post->has_featured_media() ) {
$image = '<span class="image">' . $post->get_the_post_thumbnail( 'full', $imageAttributes ) . '</span> ';
}
} }