Let me start by thanking for the great work on this plugin!
I was using this to display an excerpt of a post, when I noticed I couldn’t use CSS to format the thumbnail image inside the div. So I altered the display-posts-shortcode.php to support setting the image float property. Here’s a guide:
1) I included the option for image_float after line 57:
'image_float' => 'left',
2) Then some security:
$image_float = sanitize_text_field( $atts['image_float'] );
after line ~82
3) Altered the HTML image implementation:
$image = '<a class="image" style="float: '. $image_float .'" href="' . get_permalink() . '">' . get_the_post_thumbnail( $post->ID, $image_size ) . '</a> ';
in line ~232.
So now, it defaults to float: left for the image, and you can use the shortcode to set it differently: image_float=[left/right/etc]
Is this something that could make it into the official release? Would love this functionality!
Also, now we’re talking.. is it hard to include funcitonality to just simply display one single post? Just like the embed_posts plugin actually, except that one isn’t maintained anymore. There’s quite some uses for this actually, and I would have loved this functionality back when I was less experienced.
- The topic ‘[Suggestion] Added image_float property to thumbnail / image listing’ is closed to new replies.