CHAPTER 12: FUN WITH MEDIA

IT'S SAID A picture is worth a thousand words, so an image can tell a story a lot faster than text can. The same goes for other kinds of visual media, such as video embeds. These things can be used to illustrate a point and hence drive the text home, or even be standalone content themselves.

If you are using media elements in your site, it's important to give some thought to how you plan to incorporate items such as galleries and illustrations. This chapter is about displaying media in a WordPress site, beyond the traditional inclusion of illustrative points or inspiring scenery in your posts and Pages.

WORKING WITH IMAGE GALLERIES

WordPress has included support for the [gallery] shortcode for a long time, with all the possibilities it brings.

If you're working in the visual editor, you won't see the gallery button; you'll just see a big box telling you that it is an image area. You can switch to HTML view for a more refined representation.

What [gallery] really does is output uploaded images in a clickable thumbnail grid. Then you can let your visitors see a larger version of the image, either in your theme's design or the original file itself. The former is called the attachment page because that's what images are — attachments to blog posts. This built-in functionality should cover most of your needs if you run a text-based site that sometimes publishes images.

To fine-tune it even further, you should make your first stop after installing WordPress ...

Get Smashing WordPress: Beyond the Blog, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.