1

I know that WodPress has support for embeding animated gif images on posts but I need the animated images to be used as featured images and to be shown on the post page as well as on all my post lists maintaining image resizing and animating.

I need to maintain a responsive size of it when i display it using a grid for homepage that use for example, a custom image sizes like 340x250px Curently the animated gif it not display correctly. Ant tips?

1

A gif should work as a featured image. Upload the gif as the featured image and display on the post page (single.php) for example, using the following for the original size:

the_post_thumbnail('full');

In the case of specific image sizes, i.e.

<?php the_post_thumbnail( 'custom-size' ); ?>

WP generates static images and in that case the gif wont work.

My suggestion would be to use conditionals to check if the attachment is a gif and use the full version in that case and rely on css to match.

$image_id = get_post_thumbnail_id($post->ID);
$type =  get_post_mime_type( $image_id );
2
  • Thanks @Svarbaard ! I already know that but I need to maintain a responsive size of it when i display it using a grid for homepage that use for example, a custom image sizes like 340x250px Curently the animated gif it not display correctly. – Knott Mar 1 '17 at 11:07
  • @Knott - See my edit – Svartbaard Mar 1 '17 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.