Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * I'll concentrate on the post thumbnail code here. The other
- * stuff should be left just as Jonah had it.
- *
- * In this first example I am using the default "post-thumbnail"
- * size and I am additionally assigning the "alignleft" CSS class
- * (most themes use this to apply a float:left).
- *
- * I'm also doing a bit of a hack here by specifying the image
- * width (in this case 100px) as an inline style (it's hackish
- * because the width and height are already present in the img
- * tag output, and we're overriding those). So, this should work
- * but arguably isn't ideal.
- */
- the_post_thumbnail('post-thumbnail', array(
- 'class' => 'alignleft',
- 'style' => 'width: 100px'
- ));
- /**
- * A slight improvement would be to add a new CSS class, here I
- * have used "featured-event-thumb" and you would then add additional
- * stylesheet rules to control it's appearance, size etc, something
- * like this:
- *
- * img.featured-event-thumb {
- * float: left;
- * height: 100px;
- * margin-right: 10px;
- * width: 100px;
- * }
- */
- the_post_thumbnail('post-thumbnail', array(
- 'class' => 'featured-event-thumb',
- ));
- /**
- * One final variation could be to register a new post thumbnail
- * size and use that in place of the default "post-thumbnail"
- * size. Here I have used the notional "event-thumbnail" size.
- *
- * You would specify the target size in the thumbnail registration
- * code, the benefit of this approach being that the image sent
- * to the browser would be the correct size straight off the bat,
- * no wasted bandwidth.
- *
- * If you want to find about more about registering post
- * thumbnail sizes then see the following link.
- *
- * @see http://codex.wordpress.org/Function_Reference/add_image_size
- */
- the_post_thumbnail('event-thumbnail', array(
- 'class' => 'featured-event-thumb',
- ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement