Hi @mariannesnel,
There’s a few ways to get tiles to display without an image.
By default, WP Tiles will look for an image inside the post, if you have not set a featured image for that post.
If all your posts have a featured image, you can disable the ‘looking into posts for an image’ by setting image_source
to featured_only
in your shortcode (or set the option in the admin panel!):
[wp-tiles image_source=featured_only]
Then, if any of your posts do not have a featured image, WP Tiles will show a text-only tile, without background image.
However, if the posts you want to display without image do have a featured image, you need to apply some coding to get WP Tiles to ignore the image. If you are familiar with PHP, continue reading.
WP Tiles contains the filter pre_wp_tiles_image
to override the image-finding behaviour. If you filter this to be an empty string, WP Tiles will treat the post as a text-only tile.
For example, if you want to use a custom field ‘show_no_image’ for it, you could do something like this:
add_filter( 'pre_wp_tiles_image', function( $ret, $post ) {
if ( get_post_meta( $post->ID, 'show_no_image', true ) === 'yes' ) {
$ret = '';
}
return $ret;
}, 10, 2 );
Good luck!
Cheers,
Mike