I want to control the alignment of the featured image(the thumbnail) with the options given in the 'Set featured image' pop box.

<?php if(has_post_thumbnail()) {
   echo '<div class="border">'; the_post_thumbnail(); echo '</div>';
} ?>

I want to add to the div with the class of border a class floatleft or floatright(or nothing) according for what the user chooses.


  • Why add the unnecessary div? The img is a block. It has classes. Style the border around it directly.
    – Otto
    Jun 23 '12 at 1:45
  • because its a double border, you can see here: fanboy.co.il/works/debundle
    – ronka
    Jun 26 '12 at 21:02
<?php echo get_the_post_thumbnail($id, 'thumbnail', array('class' => 'alignleft')); ?>

see codex for more

  • i need to add the alignleft call to div with the border class. and the align needs to be a var.
    – ronka
    Jun 26 '12 at 21:01

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.