Support » Plugins » Hacks » A simple the_post_thumbnail(); issue

  • Hi,

    I coded both my loop.php & functions.php to print a 225×150 featured image but it’s printing a default 150×150 image instead, as shown below:

    in functions.php:

    <?php
    	if (function_exists('add_theme_support')) {
    		add_theme_support('post-thumbnails');
    		set_post_thumbnail_size(225, 150, true);
    	}
    ?>

    in loop.php:

    <?php
    	if (has_post_thumbnail()) {
    		$size = array(225, 150);
    		the_post_thumbnail($size);
    	}
    ?>

    Here’s the <img> the loop is currently printing:

    <img width="150" height="150" src="XXX/avatar_1a2-150x150.jpg" class="attachment-225x150 wp-post-image" alt="Resetting everywhere." title="Resetting everywhere.">

    As you can see, those width and height HTML attributes shouldn’t have those values. Also, the filename should end as “225×150.jpg” instead of “150×150.jpg”. Right? Any suggestions? It’s my very first WordPress redesign from scratch. Oh, the excitement! Thank you 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • Problem just solved. As it seems, there’s no way to do this programmatically. I just had to go to Settings > Media and change the “Thumbnails” width and height values by myself. I do think WordPress should somehow overwrite those values by the ones force on the template (like I stated above), though. Thank you.

    hmmm…. thats how it works for me?

    I have my settings->media thumbnails at 150×150

    But I use various thumbnails all over the place, in 6 sizes

    for example

    <img width="205" height="100" src="http://www.rvoodoo.com/empire/wp-content/uploads/2010/12/voodooW-205x100.jpg"

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘A simple the_post_thumbnail(); issue’ is closed to new replies.