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
    Commented Jun 23, 2012 at 1:45
  • because its a double border, you can see here: fanboy.co.il/works/debundle
    – ronka
    Commented Jun 26, 2012 at 21:02

1 Answer 1

<?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
    Commented Jun 26, 2012 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.