Skip to content

Can you disable images using image_size="false" ? #3

@billerickson

Description

@billerickson

I wanted just a bulleted list, no featured images.

[display-posts-remote image_size="false"]

Still had images. It looks like $atts['image_size'] isn't converted from the string "false" to the boolean. And even if it is, the following conditionals don't check it, only if $post->has_featured_media().

I changed the image markup section to this so I could disable images:

				if( $atts['image_size'] && false !== filter_var( $atts['image_size'], FILTER_VALIDATE_BOOLEAN ) ) {

					if ( $post->has_post_thumbnail() && $atts['include_link'] ) {

						$image = '<a class="image" href="' . esc_url( $post->get_permalink() ) . '">' . $post->get_the_post_thumbnail( $atts['image_size'], $imageAttributes ) . '</a> ';

					} elseif ( $post->has_post_thumbnail() ) {

						$image = '<span class="image">' . $post->get_the_post_thumbnail( $atts['image_size'], $imageAttributes ) . '</span> ';

					} elseif ( $post->has_featured_media() && $atts['include_link'] ) {

						$image = '<a class="image" href="' . esc_url( $post->get_permalink() ) . '">' . $post->get_the_post_thumbnail( 'full', $imageAttributes ) . '</a> ';

					} elseif ( $post->has_featured_media() ) {

						$image = '<span class="image">' . $post->get_the_post_thumbnail( 'full', $imageAttributes ) . '</span> ';

					}

				}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions