1

I've made a custom widget which shows thumbs of my latest videos. These thumbs are set to be 300px wide, which is the same width of my sidebar.

My problem is that i also want to be able to use it in my footer where the width of widgets are only 220px wide.

So basically what i want to do is: if the widget is shown in the sidebar use <?php the_post_thumbnail('media-thumb-sidebar'); ?>and if the widget is used in the footer use <?php the_post_thumbnail('media-thumb-footer'); ?>

Anyone know how i could do this? Thanks :)

2
  • 1
    Why not just use css to control the size of the thumbnails and the div ? You can have different styles on the widget for example; #sidebar .widget{width:300px;} #footer .widget{width:220px;} and obviously add styles to the img tag
    – Xavier
    Commented Apr 7, 2011 at 22:49
  • Well i'm using the built in WP function "featured image" to show the thumbs, so wouldn't i have to make some kind of if statement to change the size of the thumb depending on if it's in footer or sidebar?
    – sebfck
    Commented Apr 7, 2011 at 22:56

1 Answer 1

1

you can always get the thumbnail, but size it with CSS as Xavier mentioned.

1
  • I don't know what i was thinking, but you guys are right that works well. Thanks to you both
    – sebfck
    Commented Apr 7, 2011 at 23:04

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.