Tag Info

Hot answers tagged


You can use the wp_generate_attachment_metadata filter: function wpse_183835_to_jpeg( $meta, $post_id ) { $sizes_to_convert = array( 'thumbnail', ); $path = dirname( get_attached_file( $post_id ) ); foreach ( $sizes_to_convert as $size ) { if ( ! empty( $meta['sizes'][ $size ] ) ) { $data = $meta['sizes'][ $size ...


First add the following code to your theme functions.php: add_image_size( 'square-150', 150, 150, true ) In sarkpress-function.php file, change this line: <?php the_post_thumbnail(); ?> to: <?php the_post_thumbnail('square-150'); ?> You would have to regenerate your images by using Regenerate Thumbnails plugin Preferences: ...


The function you are looking for is has_post_thumbnail() With this function you can check, if a featured image has been attached to a post and perform the following code: <?php if( get_field( 'photos' ) ): ?> <div class="img"> <?php echo '<a class="image" href="' . get_permalink() . '"><div class="img"><img src="' ...


when you upload image to WordPress you must to fill Title field. and also your theme must use default WordPress thumbnail function.

Only top voted, non community-wiki answers of a minimum length are eligible