wp_get_attachment_image function size argument not working if I also add a custom class

Just as Tom mentioned in the comments above. The fourth parameter of wp_get_attachment_image sets the value, not adds to it so it will override the auto generated class. If you need the size class and your custom class you can simply add both of them manually like so… echo wp_get_attachment_image( $image_id, ‘image-size’, ”, [ ‘class’ … Read more

Special purpose photos with each post

Well one photo can be assigned as the thumbnail as you can see in the post editor screen. Otherwise as the comment above suggested create a post meta field for example ‘my_post_image’ and place the id of the image attachment in that field. That is how WordPress saves the post thumbnail (look in the database, … Read more

Any Short code Availble for Get Post List With Thumbnail Plugin?

here is a quick crack at making it a shortcode paste this code in your theme’s functions.php file: add_shortcode(‘gplt’,’getPostListThumbs_shortcode’); function getPostListThumbs_shortcode($atts, $content = null){ extract(shortcode_atts(array( ‘orient’ => ‘v’, ‘imgo’ => false, ‘ttgo’ => false, ‘dtgo’ => false, ‘dtfrm’ => 1, ‘categ’ => ”, ‘postnr’ => 20, ‘linn’ => 3, ‘tbwid’ => 40, ‘tbhig’ => 40 … Read more

the_post_thumbnail() Custom sizes not display correctly

If the critical dimension is height, you have a couple options: Hard-cropping to the exact width/height: <?php add_image_size( ‘wide-image-icon’, 200, 150, true ); ?> The hard-crop will create a thumbnail size using the exact dimensions. Be sure that all images have a minimum width/height as what is defined. Or soft-cropping (i.e. “box-resizing”) constrained to height: … Read more

Custom Image Thumbnails of Different Sizes

Add this code to your functions.php if(function_exists(‘add_theme_support’)) add_theme_support(‘post-thumbnails’); // Set the thumbnail size add_image_size(‘custom_logo’, 200, 200, true ); add_image_size(‘custom_website_thumb’, 450, 200, true ); add_image_size(‘custom_print_ad_thumb’, 200, 400, true ); Put this in your post template where you want to see the image. <?php echo get_the_post_thumbnail($post_id, ‘custom_logo’); ?> You can also wrap it in a link like … Read more