O'Reilly logo

Smashing WordPress: Beyond the Blog, 3rd Edition by Thord Daniel Hedengren

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 12: Fun with Media

It’s said a picture is worth a thousand words; 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, the first stop after installing WordPress and picking the theme ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required