the_post_thumbnail
-
Hello,
I have recently discovered WordPress new feature the_post_thumbnail
I now use it quite extensively for the site I am building but some aspects leave me totally puzzled : according to where I place the thumbnail on my site (home, sidebar, category page…), the size seems NOT to be controlled by the same attributes or parameters, and I had a hard time trying to understand it all.
? Sometimes I have to use the php (array) function. But it sometimes will not work, for reasons beyond my grasp. Besides, it makes the thumbnail square (I have tested several values) when I sometimes want it to keep width/height proportion.
? Sometimes I have to edit the [ .wp-post-image ] CSS class, along with [img.wp-post-image]
? Sometimes, nothing works but the [ .attachment-thumbnail ] CSS class does work.
In short, the whole stuff drives me crazy.
? Let me add that I tried several options, such as
the_post_thumbnail('thumbnail');
which NEVER did the trick but rather displays the full size image on my site, whatever I try. This particular example was solved using the [ .attachment-thumbnail ] CSS class.? And the codex pages are of little help since half of the stuff does not work (at least with me).
? Could the WP scholars sort all this out ?
Example of my own CSS :
.wp-post-image {margin: 2px 8px 0 0 } img.wp-post-image {border:1px solid #f8f8f8; float: left;} .attachment-thumbnail {width:100px;height:auto}
By the way, I did add to functions.php the necessary
add_theme_support( 'post-thumbnails' );
- The topic ‘the_post_thumbnail’ is closed to new replies.