Rockablepress.com

Envato.com

© Rockable Press 2012

All rights reserved. No part of this publication may be reproduced or redistributed in any form without the prior written permission of the publishers.

Table of Contents

Why Use WordPress?

For the Rest of This Book

Setting Up a Self-Hosted Site

Hosting — a hard drive on the Internet

Your First Domain Name Dot Com

Now put your domain and your hosting together

Here’s one I made earlier.

Choosing Your Theme

Picking a Theme for the Discussion

Using the FTP Client

Now that you’re acquainted

Onwards without the complicated configurations

How to use your chosen theme

How to Publish Articles and Other Media

Preview

How to use images, video and audio

Embedding Videos

Embedding from a different service like Storify

Press Publish!

How to Use Posts and Pages

What’s the difference?

Page Templates

One more thing

How to Use Categories and Tags

Two things are certain: death and tax(onomi)es

Adding Categories and Tags

And now for something completely different

Using Custom Fields

Open your post editor

Adding your first field

Telling WordPress where to stick it

Ugly code, beautiful results

Using timthumb.php

Featured Images

Tomthumb, timthumb.php

The world is not perfect

Adding Plugins and Some Recommendations

Adding plugins

Some recommendations for useful plugins in journalism

Battling the Gods — Where Now?

About The Author

Why Use WordPress?

Hello. You're reading this book for one of four reasons.

Either you've been told by your boss to look at how you can go about starting a blog on a minimal budget.

Or, for some reason or another, perhaps redundancy from your normal job or just opportunism, you've decided to strike out on your own.

Or, you're working at a business that is looking to get friendly with customers, and you want to know if WordPress can help you do that.

Or, maybe you're just curious about what WordPress is and how you can make the most of it.

It doesn't matter which of those reasons you're reading for, you've come to the right place.

I did my first installation of WordPress six years ago when it was a lot more primitive than the powerful beast that powers literally millions of websites today — including dozens upon dozens that I've set up or helped other people get off the ground.

In that time, WordPress has changed a lot, and there's a team of developers who are making WordPress so much easier to use while also making it increasingly powerful.

WordPress is so powerful, in fact, that even the UK Prime Minister's blog is powered on the platform. "Number 10" apparently saw that the potential to organise lots of rapidly changing content was all to be found in the 2000+ files that make up a WordPress site.

Fig. 0.1 — Prime Minister's Blog

That might seem like quite a lot of files and perhaps a little bit scary if you've never so much as formatted text using HTML or CSS (don't worry… we'll teach you everything you need to know about those two scary-looking acronyms to use WordPress — which is not much, by the way.)

The good news is that even if you fancy yourself as a bit of a coding Rambo, you'll probably only ever edit code in about a maximum of 20 of those files.

Even better news is that you could happily use WordPress without ever writing a line of code.

That's why WordPress is so powerful — you can do anything you want to and that's why you should be using WordPress over any other blogging platform.

From my very earliest days of using WordPress when I couldn't really write any code, right up until today when I write articles about how to perform powerful magic with the Codex (again, that's a word we'll tell you all about later), I have rarely felt out of my depth with using this very safe platform. I have never found a single idea that I couldn't make happen using those 20 files that I mentioned earlier.

For the Rest of This Book

This book is straightforward, much like WordPress itself. Some of the chapters will be very, very short, and others will be long. If you find that you're losing the will to live at any point because you can't understand something, feel free to just skip the chapter.

Where there's a part that you really should read, I've marked it with a special "Required Reading" note.

We'll start with one of the most common confusions that WordPress causes for people: what's the difference between WordPress.com and WordPress.org? We'll show you why journalists should always be using WordPress.org and then show you how you can go about doing it yourself. We'll talk about some of the things you need to do to set up a domain name and web hosting.

After that, we'll have a chat about what WordPress calls "themes." This is WordPress' way of quickly and easily changing the way that your site looks. We'll take a look at some really great news and magazine themes and also some basic principles of how to go about modifying the theme you use if you'd like to.

After that, we'll go through probably the most important part of WordPress for most people: writing articles and using media. We'll show you how to edit posts and pages, and by the time we're finished with those two chapters, you'll be able to tell the difference between them, embed video, pictures, Storify and other animals blindfolded and with your hands tied behind your back (… as long as you can still type and use the mouse with your hands behind your back).

Then, we're going to go through some principles of content management — or, in plain English, organizing your website's archives.

In the last third of the book, we'll fork off and go in two directions.

First, we'll explore some advanced principles such as how to use Custom Fields and how to make your website automatically resize images to fit into your template.

Second, we'll take a look at how to supercharge your site with plugins, and we'll explore the plugins of the world to see what's available for you.

After that, you'll be a WordPress champion on your way to take on the gods at Mount Olympus… or… you know… just publish your opinions if that's your kind of thing.

If you have any questions throughout your reading of this book, you can tweet me on @iammarcthomas and I'll zoom in on a cloud, play you sweet musics and solve your WordPress problems while I'm at it.

Read on, young explorer!

Marc

http://thatisjustawesome.com

Setting Up a Self-Hosted Site

Welcome to Chapter One, where we'll walk through exactly what you need to do to get your WordPress site up and running on your super swish .com domain name.

If there's one criticism that we can't help but make when we're talking about WordPress, it's the fact that there are two versions of it with almost exactly the same name, which can be really confusing for average Joe.

So, let's clear this up quickly and then move on. I don't know all of the details surrounding the origins of WordPress, but at some point the principal founder of the WordPress platform (Matt Mullenweg — @photomatt) decided to release two different iterations of WordPress.

The first is hosted by WordPress themselves. We often call this WordPress.com, and you can start a blog there in a matter of seconds. Because it's hosted by WordPress, you can't edit the code very much (even when you pay for their extra features) and you can't upload your own theme if you fancy that. WordPress.com is great for people who are flexible about their blog's appearance and want to get simple blog posts out to a small audience.

On the other hand, WordPress.org is self-hosted which means you have 100% control over everything to do with your site. WordPress.org is for people who want to do much more than just publish straightforward content. It's for people who want a content management system that could rival that of any major news organization in the world — or equally, for people who just want to be able to tell their customers what time their delicatessen opens, sell tickets for concerts or put details of their stamp collection out into the world.

For the rest of this book, we will be describing WordPress.org — the self-hosted option, because we're power users and we want full control over all of the various facets of our website.

When people ask me to build them a website, they've often got some really confused ideas about the kinds of things that they're going to need to pay for.

Hosting — a hard drive on the Internet

Most are confused about where the files for the site will be.

Every website is "hosted" on a web hosting service. There are lots of different kinds of hosts, but unless you're going to be getting hundreds of thousands of page views daily, you'll probably only ever need a basic shared host.

But what is a host?

Simple. Imagine you're writing a document on your computer. When you're done, you need somewhere to save it, right? Well, the host is just like an online hard drive. It's where all of the files you need people to see on the Internet will sit.

Generally, a web host will not be more than $15 monthly, and you can find a host for as low as $1 monthly. However, just like any other product or service, you get what you pay for!

Many times, people cause themselves a lot of problems by skimping out on their hosting bill. As powerful as it is, WordPress still relies on certain other technologies.

All good web hosts will be able to support WordPress very easily, and some of them will even offer a one-click installation process for WordPress, which makes setting up your site much easier. Breathe!

I can personally vouch for the quality of service offered by MediaTemple, but there are lots of other good hosting providers that I have worked with in the past.

If you go to WordPress.org in your browser, you'll see that they've compiled a list of a few of their recommendations for good hosts. You can't go wrong if you pick one of these.

Your First Domain Name Dot Com

If you're going to carry on with this book, you'll also need to buy a domain name for your project.

There are no websites without a domain name. It's like a house without a name or a number — no-one can find them… including the postman.

You need the Internet to know exactly where to send visitors when they type in the name of your site. For example, when people type http://plastik.me or http://thatisjustawesome.com into the browser, they're calling on the sites chosen domain name. You'll need to choose a domain for your own site.

Buying a domain name is not as hard as it seems, nor is it as expensive as it's made out to be.

Despite many people not trusting GoDaddy's business practices or ethical concerns (any large business will have a few naysayers and negative reviews), I have never had any problem using their services.

Domain names usually cost about $12 for a year, although there are discounts for buying multiple years at once.

I suggest not using the domain registration service that comes with most hosting providers, as it can sometimes prove problematic if you ever try to change web hosts in the future. Keeping separate accounts for your domains and your hosting needs will allow you to change either service more easily.

Fig. 1.1 — GoDaddy domain purchase screen.

Now put your domain and your hosting together

Pretty soon you're going to be able to complete a super easy installation of WordPress, but before that, you're going to have to wait 24 hours, I'm afraid.

The wait is 24 hours because that's usually how long it takes for a "domain propagation" which is a fancypants way of saying that it takes 24 hours for your host and your domain name to get friendly and agree that they'll work together to serve your content to your visitors.

When you sign up to your webhost, they'll send you an e-mail with a bunch of detailed information in it. Within that e-mail will be two "nameservers," which you'll need to copy and paste into your domain's settings to complete the aforementioned prima nocta (wedding night) between your domain name and your hosting company.

Fortunately, this is pretty easy. All you do is log in to your domain name provider (GoDaddy is really easy), select your domain name from within your account, and then select "Set Nameservers" or a similar option if that one's not available. Once you're on that page, you need to copy and paste in the two nameservers which will probably look like web addresses like this: ns1.yourwebhost.com and ns2.yourwebhost.com — you don't need an "http://" or a "www." in front of them. Then just click "Update" and take the rest of the day off!

Some web hosts (like MediaTemple) will require one extra step where you have to log in and "Add domain to account," but this is really easy, so don't worry. Just search your web hosts' help pages if you get stuck at this point in the process.

Here's one I made earlier.

So, after you've waited 24 hours for the papier maché to dry… uh… I mean for the domain to propagate, you'll be good to go.

Many good web hosts will offer a service called Fantastico or "One Click Installation," which makes it beyond easy to install WordPress on your hosting account.

If you skimped out on web hosting, you might have to do some legwork and configure a database yourself.

We'll look through what you should do in both instances now. Follow the section that applies to your situation.

If you went with an expensive host like MediaTemple

Congratulations! You have chosen well. Here, all you need to do is select the domain name you want to use from your admin panel (or cPanel, as some hosts call it) on your host and select "one click installation" or Fantastico.

Then, select WordPress and fill in all the fields that it asks for. If it offers you the choice to fill in some information about databases, don't freak out, but do remember the following things:

1. If you've already installed WordPress on your web host, you'll need to just add a little bit extra to your database name to differentiate between databases on the host,

2. But for most of you, just clicking proceed or submit will do just fine.

At this point, you've got your first WordPress.org site up and running. Good job!

Just one more thing. You'll need an FTP client at some point so that you can upload your theme later on in the book. It's best to have a chat about it now, so you'll be ready to go when the time comes.

What is FTP? FTP stands for File Transfer Protocol, and it is what is used to move files from your computer to your web host. If you're on a Mac, I suggest you use Transmit by Panic (Fig. 1-2) which is, quite frankly, a wonder of technology. The options for PC users are endless but you just need to pick one. We call it an FTP client but we could also call it an FTP app, application, program, thing, doodah or basically anything you want. So you're familiar with the jargon in the future, we'll refer to it as a client — but feel free to make up your own name for it in your head.

Once you've picked out, downloaded and installed an FTP client, the next step is to open up that e-mail that your web host sent you when you bought the account. It will have details for an FTP host within it. Just copy and paste the server, port, username and password into your FTP client — as the process is different for each server and each FTP client, you'll have to fiddle about on your own here, but it's not at all hard to work out.

Then click "Connect" or the equivalent button and wait for your computer to open an FTP connection to your web host.

Fig. 1.2 — Transmit by Panic.

You'll see a few things here but you should look for a folder that is called either www or domains. Find the wp-content folder and then the themes subfolder. Here's where you'll upload your chosen WordPress theme; we'll cover that process in the next chapter.

If you've managed that, go ahead and grab yourself a lovely coffee or peppermint tea to congratulate yourself. Join us in the next chapter where we'll be picking up at that themes folder.

If you skimped out on your hosting, start here

If for some reason you couldn't afford to use a host like MediaTemple or you just didn't fancy it, not to worry. We'll have you up and running with WordPress with their famous five minute installation.

As I already wrote, for the people who chose a more expensive host that has Fantastico and one-click installations, start by choosing and downloading an FTP client. Enter the login details for your website sent by your webhost into your FTP client's preferences. Then click "Connect" (or the equivalent) and you're in!

You'll see a few directories here, but you should look for a folder that is called either www or domains.

At this point, hop over to WordPress.org and download WordPress using the big "Download" button on their homepage (Fig. 1-3).

Fig. 1.3 — WordPress.org Home.

When the file has downloaded to your computer, find it and put all of the contents (but not the compressed file itself; you'll have to unzip the download) into the www folder (or the yourdomain.com folder) within your FTP account.

Because there are, as we mentioned earlier, a little over 2000 files in that folder, go put the kettle on and leave the files to upload while you make the tea. This should only take a few minutes if you've got a fast connection — probably about the time it takes to download an album from iTunes.

Before you can continue with the installation, you need to get your database sorted out. The database is the beating heart of your WordPress site and holds all of the content within its dark corners. You'll only ever need a simple database setup process and then some copying and pasting though; you'll probably never actually look inside the database.

Go ahead and open your admin panel or cPanel on your host using the instructions that they sent you in the e-mail. Once again, as each host's way of doing things is slightly different, this section is only a guide and you might have to try fiddling about yourself.

Look for an icon which says phpMyAdmin or something similar. Click it and add a new database. Give it a name and remember the name.

That's all you need to do to set up a database.

If you run into trouble at this stage, contact your web host. They're usually very good at supplying support. Although they won't help you out with WordPress at all — they probably will help you find your database password and username.

Now that your files have uploaded, type in your domain name and a screen should appear that will guide you through the installation process for WordPress. One of the steps will ask for your database name, username and password. The database name is the one you just created, while the username and password will probably have been sent to you when you bought your hosting space. Most hosts will include them in the e-mail with your nameservers that you used earlier to transfer your domain name. Remember?

Once that's done, you're up and running. Enter your domain name into the browser again and you'll see the default WordPress theme and a sample post.

Congratulations. Enjoy that cup of tea that you just made.

Chapter Summary

So, in this chapter, we've taken a look at the difference between the two WordPress services and decided that we're going to choose the self-hosted option. We've also looked at how to set up a web host with a domain name and then how to install WordPress.

In the next chapter, we'll have a look at themes, which we can use to make our WordPress installation look as good as Zeus and run like Hermes.

Choosing Your Theme

So, you've got a WordPress site, a domain name and some web hosting to host all your files, and we're only two short chapters into the book. Either you're magical, I'm magical or we're both magical.

In this chapter, we'll go even further and make your WordPress site look completely different than anyone else's.

Picking a Theme for the Discussion

Themes are what WordPress uses as site designs. A standard theme is about 20 files worth of PHP files which, together, make a site look smarter than Humphrey Bogart and Jean Paul Belmondo combined (on their good days).

Themes come in literally all shapes and sizes. Some of them are very basic and just contain little more than text styling, while some of them are complex enough to make you look like you've got a dedicated assistant who's writing your blog non-stop. Some of them have loads of extra little tools to make your life easy, and some of them leave you to do some work on your own.

We'll have a look at both kinds of themes, and we'll also talk about the Codex, a wonderful guide to everything that WordPress can do with a full explanation of every capability with examples to boot! This is one of the reasons that our little content management system is just so easy to use: every feature or function you ever wanted to know is already written and ready for your use.

After that, we'll talk about some prepackaged themes that you can buy or download for free.

Using the FTP Client

First of all though, just familiarize yourself with the themes that come packaged with WordPress itself. There are currently two of them: twentyten and twentyeleven. Twentyeleven is the default theme.

Open up your FTP client (which you downloaded in the second chapter) and navigate to the following path in the FTP client: wp-content/themes/twentyeleven

Twentyeleven is a great theme for both basic and advanced users. If you'd like a blog-like site and a way to just change the colors, pictures and layouts, then you can basically stop reading here and start using Twentyeleven straight away.

Fig. 2.1 — Twentyeleven Installation.

To see just how much you can change your website using Twentyeleven, open your domain name in a browser and then add /wp-admin at the end of the URL. That'll take you to a login page where you can enter your login details.

Once you're in there, find Themes within the administration menu, which will bring down an option called Theme Options. Here you can choose from two or three layout choices, background colors, text colors and also header images.

In the most recent version of WordPress (3.4 and above) you can also edit loads of stuff right in the browser by choosing Customize. This allows you to change the title of your site, pick colors, choose layouts, change the backgrounds and much more. Neat.

Most WordPress themes also come packaged with a "Menus" function, which allows you to specify what items you want within your navigation menu without ever writing a single line of code. That's useful if you're a "just get on with it" kind of person.

But for everyone else, let's take a look at some of the files that make up a WordPress theme. We're not actually going to edit any of them until much later on, and even then it will be entirely optional. But to give you an understanding of what goes into the theme, it's good to examine these files.

If you haven't already got a program for opening HTML, PHP or CSS files, I suggest you use Coda 2 by Panic or Sublime Text.

The first noteworthy file is index.php. This determines the front page of your website. It's actually the cornerstone of every theme, and it tells the browser exactly what order to display the other files in.

What other files are worth noting?

The header.php file contains all the information about your site that, say, Google, might want to know. We call this meta information. You will also usually find some way of navigating the site referenced in the header.php file.

The other very important thing that goes into the header file is a link to the style sheet (style.css if you're looking in your Twentyeleven folder).

Another component of an index.php file is what WordPress calls The Loop. The Loop is a programming term, but all it really does is work out which articles you want to display and then how you want to display them. It's quite a scary-looking piece of code, but don't worry about it. WordPress is really smart and handles most of the dirty work for you.

Then there's the sidebar.php file. A sidebar is exactly that — a bar that goes on the side. It usually contains things like Twitter feeds, archive information, advertisements, or online store widgets. You can configure what appears in your sidebars using the theme options section of the Dashboard (within the admin panel in WordPress), as most themes come configured with an area to drag and drop what you like into your sidebar.

Finally, there's a footer.php file in most designer's themes. The footer mostly contains information about your site like contact addresses, copyrights, legal documents, etc. Again, you can configure this stuff within the WordPress Dashboard.

Now that you're acquainted

This book is not about coding or complex configuration — that's a subject for an entirely different guide.

That said, if you are interested in learning a bit more about this, WordPress has a wiki page called the Codex. It is an exhaustive, comprehensive guide to the inner-workings of WordPress.

Even six years into my learning of this ever growing canon, I'm still finding parts of the WordPress Codex that I had never even thought of using before.

You can access it at http://codex.wordpress.org/ and make your way to whatever you want to know from there.

I would recommend reading the section on The Loop as a very good place to make a start.

Onwards without the complicated configurations

As I've said, WordPress is an unbelievably powerful platform. I have used it to make websites for charities, small companies, concert promoters, "what's on" guides, magazines, personal blogs, churches, news verification services and more.

However, because it is so complex, there are a lot of things that can go wrong. For this reason, it might be better to use (as I did at first) a prepackaged theme.

There are so many different options here that going through even the most basic would constitute a book of its own, so I'll make some suggestions and then move on.

Recently, I've been pointing people to ThemeForest.net. This vast theme marketplace allows WordPress developers all over the world to sell their themes online.

ThemeForest probably already contains a whole category for your industry. There's Blog, Creative, Retail, Technology, Nonprofit, eCommerce, Corporate and Magazine. You're probably going to find dozens of themes that you want. The best way to find one that is really adaptable is to search the shop by number of sales. Generally, people will only buy a very adaptable, easily customisable theme which allows you to configure galleries, colors, layouts, image sliders and more.

A theme like Periodic costs the very cheap price of $35 and comes with a bunch of colour schemes predefined, a suave slider for photos, a couple of layouts, Twitter and Flickr stream widgets for displaying your tweets and photos, and a whole host of other capabilities too. This one is perfect for a magazine website.

There's also a very good theme called Repro, which has a similar range of features but is a little less flashy — this might be preferable to some people.

For a news website, the Deadline theme is an excellent option. It costs $35 and is one of the top selling themes on ThemeForest because of its adaptability.

I've recently found myself recommending Brandon Jones' SuperSkeleton theme because it works so easily and looks great on huge screens as well as tiny little mobile screens.

There is a theme for every kind of industry: childcare, restaurants, nonprofits and creatives.

Another good source of practical themes is WPShower. This website has quite a few themes on it that you'll occasionally recognise if you browse WordPress sites for long enough. However, a lot of these themes seem quite complicated to configure, so I'd proceed carefully unless you're interested in getting into the code.

Ultimately, a theme is a matter of personal choice, and you'll have to decide what works best for your project.

How to use your chosen theme

Most of the time, you'll have to upload a theme yourself. Unless you find one in WordPress' own theme directory (which is increasingly uninspiring), you'll need to download the theme from another website to your computer before uploading it to your own.

Let's assume you went ahead and bought yourself a theme:

1. Open up your FTP client just like you did before and navigate to the themes folder (it usually contains starter themes like Twentyten and Twentyeleven).

2. Select the folder that you downloaded.

3. Upload it to the themes folder and wait for the transfer to complete.

4. Then go to your WordPress Dashboard.

5. Click Appearance > Themes.

6. Select your theme and click Activate.

And that's it! You've uploaded and activated your new WordPress theme.

If you bought a theme from ThemeForest, it comes with a VERY detailed readme file that tells you how to configure your site.

It's up to you to explore the theme's options to configure away and fiddle about until your heart's content.

Most theme authors will offer a basic support service, so if you get stuck, you can leave them a message.

Chapter Summary

And that's themes! You're climbing Mount Olympus pretty quickly now. Soon you'll start seeing Zeus' beard trickle down the mountainside.

In the next chapter, we're going to have a quick overview of how to use the post editor, which will start you off on your publishing journey. We'll look at how to upload photos, audio, video and also how to use WordPress to embed content from other websites.

How to Publish Articles and Other Media

The next three chapters are the last required reading chapters of this book, but they're also probably the ones that will be most useful to you.

We're going to talk about how to write content and organize media using WordPress.

You learned to write in school already, and this book isn't about writing. This is about publishing what you can already write: information about new products, news stories from your company or hyperlocal journalism.

In this chapter, we'll be making the jump from writing on your laptop to publishing on your site. In the following two chapters, we'll take a look at how to organise this writing.

Unlike other content management systems, publishing on WordPress is very straightforward. If you can write and send an e-mail, you can publish using WordPress.

There are two kinds of content that you can publish using WordPress: posts and pages. We're going to go over the differences between the two in a different chapter but for now, we'll just be using posts.

If you're not there already, log in to your Dashboard (yourdomain.com/wp-admin) and we'll get started.

When your administration panel is loaded, click in Posts and choose Add New. That will bring up the page in Fig. 3.1.

If yours looks a little different than mine, don't worry too much. You're on the right page.

Fig. 3.1 — Post View.

At the top of the page, you've got space to type in a post title. Keep it quite short, as most themes only allow for a short title.

Underneath that, you've got a text editor where you'll be writing your article — or pasting it in, if you're so inclined.

This box has two tabs: Visual and HTML. Visual has a big set of options just above it. Because if it's extensive array of text-editing tools, these buttons are collectively called the "Kitchen Sink." It allows you to highlight text and then select formatting options. You can make text bold, underline, italic, hyperlinked and much more. If you're unsure what those buttons do, just hover over them to get a better idea.

Within the HTML tab, you have fewer options, but you can use any HTML tags that you like, including advanced HTML formatting.

I use the Visual tab for most of my writing and editing work, but I occasionally switch to the HTML editor if I want to use a lot of photos in a post, for example, as sometimes it can be quite hard to get a detailed look at how the page will turn out.

If you don't want to use the HTML view, you don't ever have to.

Preview

If you're worried about getting all of your formatting wrong, don't worry too much. It doesn't have to be a big surprise when you press Publish. You can press Preview first!

There's a handy Preview button above that Publish button, which you can use to see how your post will look on the website when it goes live. You can use it as many times as you like while editing the post. Just remember to not try refreshing the page as it won't always work; click the Preview button again to see the changes you've made.

How to use images, video and audio

WordPress is made to accommodate rich media easily. So much so that it has an uploader to handle all types of media.

That uploader can be found by clicking a fairly well-hidden little logo above the kitchen sink. It's next to a label that says Upload/ Insert.

Images, video and audio are all easily uploaded and inserted into your posts by clicking this logo, selecting the files from your hard drive and clicking upload. You can also upload files by dragging them into the WordPress media upload window. Then, click the file that you've just uploaded in the media uploader and choose the button that says Insert into Post. There are a couple of options such as:

- Title – This allows you to add a title for the benefit of the visually impaired and search engines. It also helps with organization of media in WordPress; you can find your old uploads far easier if they have titles.

- Alt – This adds an "alt" description to your media. If a browser can't render your media, it will display this alternate description instead.

- Caption – This will add a caption below the image in most themes.

- Alignment – This aligns your media to the left, right or center of your post.

- Size – This option offers you some basic control over the size of your image. If it's too big, you don't need to edit it in a separate program; you can simply "shrink" the image to fit your needs.

There are also a couple of other options there, but they aren't used as often as the five described above. Actually, I rarely use any of these options in my day-to-day use of WordPress.

Embedding Videos

With the rise of YouTube, Vimeo and other video providers, as well as the availability of video recording equipment, it became quite important for WordPress to streamline the embedding process which used to entail an awkward process of going to the website, searching for embed options, copying an HTML code snippet and pasting it into the HTML tab of your post editor (and then hoping it all looked good when it was published).

Now, embedding videos into your articles is a lot easier.

WordPress' most recent versions have enabled auto-embedding of links from rich media websites like Flickr, Vimeo, YouTube and even Twitter.

To make use of it, all you have to do is paste the URL of the file that you want to embed onto a line of its own in the post editor. For example, the following will work nicely:

Fig. 3.2 — If you have the latest version of WordPress, pasting the full URL of a YouTube video into your post editor will render it as a video once it's published. Remember to make sure that it's not a hyperlink!

But this hyperlinked version will not embed the video, it will stay as a hyperlink that leads visitors off of your website (Fig. 3.3).

Fig. 3.3 — Pasting a hyperlinked URL to a YouTube video does not result in an embedded video. It remains a hyperlink once published.

Conveniently, the embed will also stretch to fit any width. If you'd like it to auto-embed at a size different than the default (600px), just click Settings > Media, from the Dashboard sidebar on the left and enter a different value in the box that says maximum embed size.

Hey presto! You've got a really sweet-looking video or image gallery on your page (Fig. 3.4).

Fig. 3.4 — This embedded video was just a URL within the post editor, but WordPress turned that text into the video itself once the post was published. Your readers will love having your multimedia right on the page.

Embedding from a different service like Storify

Increasingly, sites like the one you're building will use live blogging or content curation services such as the incredibly powerful Storify.

Embedding content from that has to be done the traditional way (by cutting and pasting HTML snippets), but it's still quite easy.

Sometimes WordPress has a little bit of trouble embedding using the HTML code, and sometimes it deletes the code from the post editor altogether. While this is frustrating, it doesn't cause any permanent damage; you just have to paste it back in. I recommend embedding as the last thing you do before pressing publish to avoid this annoying little glitch, especially when embedding Google Maps!

Just choose the Storify page that you'd like to use, and get the embed code, which should be quite easy to find on the page (Fig. 3.5). Then, jump back into the post you are writing and select the HTML tab. Paste all of the embed code wherever you want the Storify content to appear.

Fig. 3.5 — Storify Embed Locate.

Press Publish!

Once you're happy with all of your formatting, media and embedding work, just click Publish and then take a look at your site.

"Yippee," you can now say as you behold the fruit of your first WordPress trial. You're kind of like Jason the Argonaut — Unstoppable.

How to Use Posts and Pages

We're over halfway through our crash course in WordPress for journalists. We've looked at how to set up a WordPress site where you can publish your own stories with complete control over how your site looks and functions. We've also checked out the post editor and how to write posts using rich media, as well as how to embed videos and other elements.

You might remember that we talked about two different kinds of content that you can publish: posts and pages. This seems to cause quite a lot of confusion for people who are new to using WordPress or have used a different CMS before — perhaps one that was made for their previous employer.

I think that part of the problem is that terminology on the Internet is so specific. In spoken English, we can freely substitute the terms page, post, article, story, feature with one another and happily say exactly the same thing. But, on the Internet, those five words can cover dozens of other usages and words in other contexts.

However, it's really not as complex as it seems.

What's the difference?

It's easy. WordPress likes to distinguish between information that changes over time (posts) and content that remains largely the same (pages).

Posts are used whenever a piece of information has a date attached to it in some way. For journalists, this is a very important distinction to make. Every single story that you ever file and every feature that you want to publish should be a post. That's because the information is temporal — tied to a certain, specific time. The same thing goes if you're a shopkeeper who wants to let customers know about a temporary sale. You don't want the sale to last forever; only intend to offer it for a week or two. Posts also have a lot of ways to sort content. Each post has what WordPress calls Categories and Tags. We'll be talking about those more in the next chapter. Don't worry about them too much right now.

Pages are used whenever information is going to stay the same for a long time or doesn't have a time or date attached to the information included in it. If you run a concert venue, you can use pages for things like your contact information or an FAQ page, or maybe even a biography/history of the venue including rates (as long as those rates don't change frequently). These things will rarely change and aren't affected by time, and for that reason, they should be pages within WordPress.

Unlike posts, pages do not have categories or tags applied to them. However, pages can be organized hierarchically. These are called Parent and Child Pages (neat name, right?)

Lets use our earlier page example of a "Contact Us" page to demonstrate parent pages, child pages and the parent/child relationship.

When you write your contact information on a page and press publish, you might also decide that you want to publish separate contact pages for general inquiries, hire inquiries and catering inquiries. One way to do that would be to have three separate pages. The page that people see when they click Contact in your navigation menu could lead to general enquiries. Then, you've got two separate "child" pages which could be called "Hire Contact" and "Catering Contact." Those two would be child pages of the parent page called "General Enquiries."

If you want to make a child page, just build a new page within WordPress by clicking Pages > Add New. You'll see that the page editor looks almost exactly like the post editor, which you saw in the previous chapter. Once you're happy with your page's content, just select a parent page from the drop down menu in the Page Attributes box, which is just below the publish button on the right side of the editor.

Fig. 4.1 — Page Attributes.

When you make a child page, you indicate a hierarchy. If your theme supports dropdown menus — those snazzy menus that show you subpages when you hover over them — then child pages will almost certainly be displayed in this way.

Child pages can also have child pages of their own, and those child pages can have child pages ad infinitum. The parent/child relationships can have as many tiers as you'd like, but it's probably best to have no more than three.

Page Templates

The other peculiar thing about pages is the ability to choose different templates just by clicking.

Some themes come packaged with extra page templates, which may contain a few extra columns or a different site layout, or anything else that the theme author can imagine and build.

I've seldom found a use for page templates in my work, but you might stumble across an opportunity to use different page templates for different purposes. As you can see from the above image, the template selection option is just beneath the parent page selection option.

Choose away and press publish when you're done.

One more thing

We've pretty much said all that we need to say about posts and pages. Because of the nature of most websites, you'll only use pages for the first few weeks that you use your WordPress site and once you've put in all the contact and biographical information, you might just go back to writing and publishing posts indefinitely.

Should you need to display some static information as the page that people see when they arrive at your site (in other words, if you want to make a WordPress page your homepage), you can choose to have any page as the front page by going into the Settings > Reading options panel within your Dashboard.

From there, change the radio button that says Your latest posts to A static page and then select the desired homepage from the drop down.

Click Save Changes and then have a look at your site's homepage.

Chapter Summary

And that's what you need to know about posts and pages: posts are dynamic, pages are static. You can organize pages like a family tree and choose different templates for individual pages if they come packaged in your theme.

In the next chapter, we'll take a look at how you can organize posts and why it's different than the way that we organize pages.

How to Use Categories and Tags

Are you starting to feel omnipotent with all that WordPress knowledge you're gathering in your mind? You should be! You're almost a publishing pro.

But currently, you're not using any kind of management in your content management system.

Last chapter, we went on a whirlwind tour of the differences between posts and pages. We saw that pages are hierarchical and can be organized in much the same way as a lovely little family tree with parents, children and even grandchildren.

However, posts are not hierarchical. They prefer to break down the family unit and be labelled by their qualities instead, and thus they require a different management system. In fact, they've got two commonly used systems by default. The latest version of WordPress offers a third ability to make as many organization systems as you'd like if you're a super power user and like to get up to your waist in code.

In this chapter, we'll talk mostly about the first two with a quick mention of the third before we chat about the near-infinite number of ways that you can classify posts in the final chapter of this book on custom taxonomies. But, you don't have to worry about those cheeky little things right now.

Two things are certain: death and tax(onomi)es

Taxonomy is not a word that most people use in everyday life — unless they're using a content management system like WordPress day in day out. And now you are potentially one of those people, so you should probably get using to saying it.

Taxonomy. Taxonomy. Taxonomy.

Great. Now that you've got the hang of saying it, you should probably learn what it means too. A taxonomy is defined as a "scheme of classification," and that's all! They're ways of organizing our information into a nice sensible structure.

When we're talking about posts in WordPress, we speak mostly about two taxonomies: categories and tags. According to WordPress' own documentation on the subject, which, by the way, is excellent, WordPress initially just used categories. But, people kept misusing them, resulting in ridiculously long lists of categories on people's websites.

Seeing that this had happened, WordPress decided that they should create a second taxonomy called tags, which could be used to describe very specific things. You could think of tags as "microcategories."

Like pages, categories, are hierarchical. You can have a category in which you include all posts that are about the European Union. Then you could also have 27 sub-categories (although 27 is probably a little excessive) with the names of all of the EU member states. You'd assign one or more categories to each post.

In that way, your users would be able to search for all posts in the "Spain" category, for example.

Essentially, categories are used to describe your content in very general terms. To work out what categories you're going to use on your site, I suggest sketching a little spider diagram.

In the center, write the name of your site. Connected to that, write all of the topics that you're going to cover. If you're a bar, you might have:

- New Cocktails

- Upcoming Events

- In the Chef's Pantry

That should give you a good idea of what categories to create. Try to keep the number of categories to a minimum, because it tends to leave you with a very messy reading experience for your reader if you use more categories than you need.

Before we talk about how to go about creating categories, we'll just take a look at the other taxonomy too.

Tags are used to describe relationships among posts that would be messy and impractical to build using categories. Also, because they're more like descriptive tools than navigational tools (i.e. rarely will they appear in the navigation bar or sidebar of your blog, although it is obviously possible), you can use a lot of them on each post.

WordPress' search function will look long and hard at the tags that each post has, as will Google and other search engines. So, it is well worth using them and being descriptive.

Imagine we're talking about a court case on a news website. The category would almost certainly be "News." But, because there are so many different kinds of court cases — and people find things much more easily using search tools — you can assign a whole heap of tags, such as: the name of the judge, the name of the defendant, the name of the prosecutor, the barrister, what kind of court it was, what kind of crime it was, guilty or innocent.

So our post might look like this:

Man Convicted of Murder at Cardiff Crown Court

Category: News

Today John Doe was convicted of the murder of 40-year-old plumber Jane Deer. The defendant was represented by Arthur Rimbaud. The judge sentenced Doe to an unusually long sentence of 40,000 years.

Tags: John Doe, Jane Deer, Arthur Rimbaud, Cardiff Crown Court, guilty, murder cases, Cardiff

As you can see from my appalling writeup of the court case, I am a magazine journalist predominantly, and I rarely have needed to know how to refer to a high court judge in an article. So, I'll pick a slightly more magazine-like example instead:

Review: "Begin to Hope" — Regina Spektor

Categories: Music, Reviews

Regina Spektor, purveyor of communist kitsch pop releases her album "Begin to Hope" this month. The mishmash of musical styles calls to mind the grand old ladies of piano jazz mixed with the punk stylings of the CBGB scene in New York City during the late 1960s and 1970s.

Tags: Regina Spektor, CBGB, New York City sounds, begin to hope, 2006 releases, Sire Records, communist kitsch, piano jazz

Notice that in the above example, I've used two categories. This is to help with organization. Often, people will want to read reviews only, so it's helpful to file pieces within a reviews category as well as a music category.

Adding Categories and Tags

Now that we know what the point of categories and tags is, we can begin using them.

There are two ways to add both categories and tags.

The first way is to use the Categories and Post Tags options from the Posts menu on the WordPress Dashboard. However, there's not really much point in this, as you'll have to type them all out again when you want to add them to a post. So, I'll only mention it briefly and say that you just click it and type in tags individually and click Add New Post Tag or Add New Category respectively.

The second and much more intuitive way of adding tags is from the post editor. When you're writing a post, you can select an existing category, or if you've never added one before, you can create a new one by clicking + Add New Category just below the list on the right side of the screen.

Fig. 5.1 — Tags and categories are two great ways to keep your content organized. After reading an article they liked, your readers can find similar articles through your categories and tags.

In the case of tags, you can write away to your heart's content using the box just below the Categories box. Just remember to separate each tag with a comma and include a space after each comma. Unlike categories, tags are not case-sensitive, so you don't need to worry about that. If you get it wrong, once you've clicked Add, just delete it by clicking on the cross icon next to the misspelling.

And now for something completely different

As I mentioned to you, tags and categories are the main two taxonomies but there is the ability within WordPress to create new taxonomies. You can also create custom fields to tailor your WordPress installation to specific needs; we'll show you how to use those in the next chapter.

With the rise of popular microblogging services like Twitter, Tumblr and image sharing tools like Twitpic, etc. WordPress' developers felt the need to add their own little capability into the mix. Cue: post types.

These allow different templates to be used for different kinds of content. The default theme Twentyeleven comes with seven choices of post types (although there are some others supported too) which can — like categories and tags — be selected from within the post editor. These are:

- Standard – the default post type with all the bells and whistles.

- Asides – for short excerpts of text similar to Facebook wall posts.

- Link – this is for links. Genius.

- Gallery – for sharing galleries of images, which can be created using the media menu, which you'll find just below the post editor option.

- Status – like a tweet for WordPress.

- Quote – for quoting excerpts of other written content.

- Image – for a single image.

As you can probably tell from my descriptions of them, a lot of these post types seem impractical in the light of the power of the options that you get with the "Standard" post type — which, by the way, is checked by default in the post editor.

However, in some themes, there may be some special templates for each post type. Indeed, Twentyeleven has a separate template for every one of them.

I once found it a bit annoying to use them, so I just stopped. I found my website improved vastly in terms of usability after I cut them out of the picture.

Again, it's up to you.

Chapter Summary

So, you can install a self-hosted WordPress site like it's nobody's business, get yourself a domain name, set up FTP clients like a boss, choose a theme, configure the theme better than all of your friends, write a post, create a page, organize the heck out of them using both tags and categories, and you even know the difference between taxonomy and taxidermy. You're 60% of the way to becoming WordPress omnipotent.

In the next chapters, we're going to come up against some code for the first time. You'll get to meet the three heads of Cerberus (custom fields), the cyclops that is timthumb.php, you'll battle with juggernauts (read: plugins) and descend into the underworld and beat the mysterious gatekeeper Custom Taxonomies before coming back to rule over your kingdom, having smited all the gods (the people who said you'd never be able to publish your own magazine/shop/bar/dentist/pet-cemetery information site).

Onwards, brave Ulysses! Glory awaits.

Using Custom Fields

Hey, are you ok? You're looking pretty tired… well… I would be too if I'd just gone from WordPress zero to hero in a matter of chapters. Only kidding! You look GREAT.

That's a good way to start this chapter. We'll be looking at some code for the very first time in this book. While you don't have to follow the final chapters of this book at all, I would recommend them if you would like to go beyond publishing a blog. Some of the tools that we're going to talk about in the next four lessons are incredibly powerful, like Zeus' thunderbolt or Poseidon's trident!

Custom Fields are an incredibly useful addition to WordPress. They enable us to organize in ways that used to be impossible. To illustrate exactly what they do, let's imagine an example.

I've got a post about cats and I want it to have a short title (10 best cat pictures) and also a long title (Oh my gosh, these 10 cat pictures are so sweet that I want to die from joy!). Obviously, you'd never put a title that long into your title field on the post editor, right? It's way too long and it would look stupid on your theme. Generally, you only ever use about 30 character maximum for that kind of thing.

Fortunately, Custom Fields allow us to use long titles as well as short titles. Let's do a walkthrough together.

Open your post editor

At first, you probably don't see a space for custom fields and you're wondering if I'm going absolutely mental and just writing about stuff that I wish WordPress could do. Don't worry, your back- end looks normal. Well, your WordPress back-end, at least.

When you first start using Custom Fields, they're actually hidden. To unhide them, you need to click Screen Options in the top-right corner of the screen when you're inside the post editor (Fig. 6.1).

Fig. 6.1 — If you can't find a "Custom Fields" section within your post editor, it's probably hidden. Click on "Screen Options" to make sure that you custom fields are displayed within your post editor.

That will bring down a box with a whole bunch of options in it that looks like this:

Fig. 6.2 — If you check the "Custom Fields" checkbox, you should find a Custom Fields editor below your post content.

Actually, yours will look a little different, because I've already selected some options there for myself.

There is an option there to tick a box next to Custom Fields. Click it and then close the tab again.

You'll notice that when you scroll down to the bottom of the post editor window that you've now got an extra box offering you the ability to add a new custom field.

Fig. 6.3 — To add a Custom Field to your post, simply choose it and declare a value. Your website may have a list of custom fields that already exist.

That's right. Now you're ready to go. Almost.

Adding your first field

This could not be easier. All you do is select Enter New to change the box to look like this:

Fig. 6.4 — If you're making a brand new Custom Field, you'll have to write in both the name and the value.

Let's say we're going to keep on following the example I gave earlier, and we want to add a long title to some our posts. We would just type "longtitle" into the Name field, and then we'd type "Oh my gosh, these 10 cat pictures are so sweet that I want to die from joy!" into the Value field.

Then press Add Custom Field, and update your post by clicking Save, Publish, or Update, depending on the status of your post.

Now, if you view your post, you'll probably be a bit disappointed because you can't see your overly-long, gushing title about cats anywhere in the post.

The reason is simple. You haven't told WordPress what to do with your new Custom Field.

Telling WordPress where to stick it

Unfortunately, here's where you're going to have to write some code but luckily for you, the WordPress codex is at the ready to help you with Custom Fields, or any other aspect of WordPress. Find the section on "Custom Fields" within the Codex, and copy and paste the code examples.

(You'll likely have to accommodate WordPress' code examples to match your own custom fields.)

First, open up your FTP client. I like using Transmit by Panic; it's the best one I've found, but it does not matter which one you choose. Log into your theme folder via FTP and then…

Second, you need to open up the single.php file in your code editor of choice. I like to use Coda 2 by Transmit, but you could use any code editor you'd like, including Notepad or TextEdit.

Once you've got that open, do a search for the text that looks something like this:

<a href="<?php the_permalink() ?>" rel="bookmark"><?php

the_title(); ?></a>

Found it? If not, don't worry. The part that you're really looking for is where it says the_title(); because that's the part of the page template where WordPress is told that you want to put the title (see how easy it is!) into the post. It's usually a few lines before a similar piece of code which says the_content();. I bet you can't guess what that part displays.

We don't want to show the default title of our posts; we want to allow some space for a long, descriptive title. That's why we added the custom field longtitle, remember?

Highlight that code you just found and replace it with this code:

<?php $longtitle = get_post_meta($post->ID, 'longtitle',

true);

//Checking if anything exists for the key longtitle

if ($longtitle) { ?>

<h2 class="posttitle"><a href="<?php the_permalink()

?>" rel="bookmark"><?php echo get_post_meta ($post->ID,

'longtitle', true); ?></a></h2>

<?php } //if there is no longtitle then display the

normal post title

else { ?>

<h2 class="posttitle"><a href="<?php the_permalink() ?>"

rel="bookmark"><?php the_title(); ?></a></h2>

<?php } ?>

That seems like a lot of confusing stuff right? Well, actually, it's not once you know what it does. It's kind of like a test for WordPress — technically, it's called a query. WordPress checks with the database entry — which gets created when you press Publish on the post — and then it looks for a custom field called "longtitle."

Let's work through it line-by-line, so that you know what's going on.

<h2><a href="<?php the_permalink() ?>" rel="bookmark"> ...

</a></h2>

This section just gets the link to the post, so that you can click on whatever title WordPress finally puts in the place of that ellipse — it uses the H2 (second biggest header) style to format the link, because we want the headline text to be nice and chunky.

<?php echo get_post_meta ($post->ID, 'longtitle', true); ?>

Then, it checks the custom fields (post_meta) to see if there's a field called "longtitle." We've set one up, so there'll be no problem, it will output the big long title about cats and trololololing into the space and make it clickable.

But, what if there isn't a longtitle custom field for some reason?

Well, that's ok, because we've let WordPress keep right on ticking using this code:

<?php } else { ?>

<h2 class="posttitle"><a href="<?php the_permalink() ?>"

rel="bookmark"><?php the_title(); ?></a></h2>

<?php } ?>

All that that code above does is to say "if there isn't a field called ‘longtitle,' then just put in the normal post title and be done with it!"

Ugly code, beautiful results

The great news is that once it's all saved and you've uploaded it using your FTP client, you'll never have to write that again, because WordPress will know that it should look at every post for a field called "longtitle," and it also knows what to do if you've decided to not use that custom field. (You're not going to make an incredibly long title for every post, are you?)

Chapter Summary

Congrats on using your first custom field. I bet you thought you would need to be a programming hero to do that, didn't you? Well, WordPress is simple. The smart guys at WordPress HQ did most of the hard work, so people like you and I who are more concerned about just publishing content can relax.

In the next chapter, we're going to look at a bit of an advanced use of custom fields to tackle post images — pictures that make our posts look a little bit better.

Using timthumb.php

Now that you're right up to speed with custom fields, you can start to get a God complex and take on the task of automatically resizing images. After this, you can let Photoshop gather dust in the corner of your applications folder.

You know when you're looking around a news website and you see that they've got super snazzy images that are all the same size? If they've got a couple of hundred articles, they must have spent ages cropping and resizing images on their graphic program of choice, mustn't they?

Actually, probably not. If they have been doing that, they've been missing a huge trick. Well, two huge tricks.

When you're using WordPress, there are two ways of resizing images to illustrate your posts in a dynamic way — that is to say, a way where you don't have to agonize over pixels every time you want to make your site aesthetically pleasing.

We're going to look at both of those really neat methods.

Featured Images

Since WordPress realized that it was fast becoming the most important content management system around, they've been working on building a feature into the platform that allows people to simply click a button and set a featured image for each post.

Most, if not all, themes that you can download now will make use of this, and using it is so easy that it's barely worth describing in this little section.

To use it, go into your post editor, upload an image and when it has uploaded, select Use as featured image just below the dimension choices.

Fig. 7.1 — If you click "Use as featured image," your WordPress theme will know to use the chosen graphic to represent this specific post on your website.

Easy peasy! Press update, and if your theme supports them, this will appear right where the post's featured images are displayed.

Tomthumb, timthumb.php

However, if that doesn't work out for you and your theme doesn't support featured images, there's a really good script (a small piece of code that can be used by anyone) which will do the job just as well — if not better.

However, it means you're going to need to configure some stuff. Open up your FTP client again and also open your code editor.

Navigate to your theme folder. If there's not one already, make a new folder called "scripts" (without the quotation marks). There doesn't have to be anything in it right now; we're going to add something in a moment.

The script we're going to use is called timthumb.php, and it's an incredibly powerful tool for resizing images and using them in WordPress.

The basic idea is that whenever you make a custom field called "image" and add a link to the image that you want to use on a post, timthumb.php looks for that image, resizes it to any size you specify, and then puts it into the website in the place that you choose.

To download timthumb.php, go to the following address to get the latest version:

http://timthumb.googlecode.com/svn/trunk/timthumb.php

Now, copy all of the code from that page (you don't have to understand it at all). Once you've copied it, open up that scripts folder in your FTP client. Create a new file called timthumb.php.

Once you've done that, open the file in your code editor of choice and paste in the code that you just copied. Then, press save.

Done that? Good. You're almost ready to resize the heck out of some images using only your mind (and WordPress).

Here's what you've got to do.

Open up any template file in your theme where you want to display a custom-sized post image. Try using the index.php file, It's the most common template file of all.

Once you've got that open, look for that title tag again — because people generally like to use images below headlines. If you've forgotten what to look for, just search (Apple + "F" or Ctrl + "F") for the following text: <?php the_title(); ?>

After that text, paste in the following:

<img src="<?php echo bloginfo('template_url'); ?>

/scripts/timthumb.php?src=/<?php $values =

get_post_custom_values ("Image"); echo $values[0]; ? >

&amp;w=700&amp;h=400&amp;zc=1&amp;q=100" alt=".<?php

the_title(); ?>." width="700px" height="400px" />

Some of that code you'll probably recognize. You can change the size of the image that will be displayed by changing both sets of width and height values (700 pixels and 400 pixels in our example).

What this does is to look for a custom field called "image" on each post. When it finds it, it will resize and crop the image proportionally and then whack it onto the front page of your website (or, wherever you may have pasted the code).

So, let's add an image together. Go to your post editor and upload an image.

Fig. 7.2 — Finding the Image URL.

Instead of inserting it into the post using the button, select the last half of the text in the box where there's a link to the image. Generally speaking, you'll need to copy everything after the .com or .co.uk or whatever ending your domain name might have.

Copy that text and paste it into a new custom field (remember how we added those in the previous chapter?), and then give the field the name "image."

Press update and you're away! You've resized an image with code magic.

You can have as many examples of this as you want on your website. If you need several different sizes of image, just copy and paste the code again and again — until you're sick of seeing it — just remember to change the dimensions that you specified in the code.

The world is not perfect

There are, unfortunately, drawbacks to both methods of handling images in WordPress.

When it comes to using the Featured Images approach to handling your post images, the problem comes from a lack of functionality — there isn't an easy way to make sure that your images always appear at a consistent size.

While you are able to set an image size in the functions.php file and include choices about how you want to crop the image in WordPress, there isn't actually a way to make absolutely certain that your image displays in that nice, neat little space where you want it to be.

As for timthumb.php, there's a problem with security from time to time. Occasionally, some unscrupulous hacker will work out a way to exploit this super-powerful script. At this point, most good web hosts will disable the script so that you don't get your website invaded by hackers. While this is helpful in the long run, in the short term it can be kind of annoying, as all of your images will disappear during the time that your host disables the script. If this ever happens to you, just open a support ticket with your host and they should be able to give you a bit of support in how to resolve the issue.

Chapter Summary

As I said, I expect that you probably won't need to use timthumb.php because of the way that WordPress themes are now integrated with a function that WordPress has made itself in order to meet the needs of people like you (featured images).

But, in the case that you ever do use a theme without support for featured images, now you know how to do it yourself.

Adding Plugins and Some Recommendations

Well, here we are! The final chapter of our journey together.

In the past eight chapters, we've gone through everything from setting up a domain, to using FTP to upload your files, to setting up a WordPress site, to choosing a theme, writing posts, uploading media, and organizing your content.

Now, we're going to talk about plugins.

Plugins are kind of like when you buy a set of Pokémon cards and then spend loads of time getting extra cards to make your team more powerful — not that I… uh… know about Pokémon cards or anything.

Let's say that you want to add a function to your WordPress but don't want to write any complex code. You could use a plugin to do that.

Like themes, plugins come in all shapes and sizes. Some are free; some are expensive. Sometimes they'll suit your needs, other times you'll probably prefer not to use them.

Adding plugins

Adding plugins couldn't be simpler. You just open up your Dashboard, click the plugins option and then search for it in the WordPress plugins directory, which is built right into your WordPress environment by default. When you've found one that you like, just click Install.

Alternatively, if you stumble across one that isn't in the plugin directory for some reason — some people sell them on sites like CodeCanyon.com — you can upload a zip file containing the plugins using the Upload option which is at the top of the Add New page within the plugin area.

If you're not up for doing it that way, as a last resort, you can use that FTP client to upload it into a folder of its own. You'll find the plugins folder within the same set of folders that contain the themes folder.

You can turn plugins on and switch them off again using the Installed Plugins page within your WordPress Dashboard.

Some recommendations for useful plugins in journalism

Not everyone likes using plugins, but I think that there are some really useful ones out there for extending WordPress really simply.

The first one that you should use is called Akismet, and it comes preinstalled with WordPress. It filters out spam comments like a fiend, and even if you turn commenting off and decide to use a different commenting plugin (see further down), you should really use it. You'll need to sign up at WordPress.com for an API key (kind of like a really complex password) but this is a free plugin, and you can do it by following the links that appear when you press Activate on the Akismet plugin.

Another plugin which is well worth using is the Jetpack plugin — also by WordPress. It just adds some really useful little functionalities to your blog and links them to your account using that WordPress.com account you got when you signed up for Akismet. I actually use the site stats function that comes with Jetpack all the time to make sure that I know if I'm doing a good job promoting my news and articles. It's a really neat analytics interface that's better if you're not ready to wow the world with your Google Analytics data. There are also good uses for Jetpack as far as social sharing buttons, subscribers and comments are concerned, with mini-plugins prepackaged in the Jetpack plugin to handle each. This is probably my favorite plugin for WordPress. It is so useful in whatever industry you're working in. There's something in there for everyone.

WordPress SEO is — although a lot less sexy than finding out you're mega popular using Jetpack — vital for promoting your content on search engines. What this plugin does is to add a couple of boxes to your "Edit Post" view that ask you for some guidance as you how you would like your posts to appear in search engines like Google. It offers some extra options for keywords that people can use to find your site using search, and it even tells you how well you're doing at preparing your content for search engines. In case there's some confusion over exactly which WordPress SEO plugin this is, the author is a man called Joost de Valk, and he's a titan of WordPress SEO.

But, we shouldn't forget that there are other redeeming qualities of WordPress beyond just its efficiency and cleanliness. You might also want to use your blog to highlight certain bits of content. For that, I really recommend Royal Slider, which is one of those slider plugins that scroll constantly between several images, which link to articles of your choosing, like on the BBC website, for example. You can purchase it for the very reasonable price of $20, and it comes with a lot of good examples and a really easy-to-use installation guide.

And of course, we can't forget commenting! You want to give your readers a way to interact with the articles that you've written. WordPress has a comments system for that, but it's not particularly good because users have to sign up to comment on your blog or log in with WordPress-specific credentials.

Instead, you might want to use Facebook comments, which allow people to comment with their Facebook IDs. Let's face it, they're more than likely to be logged into Facebook than your website. There's a free plugin called Facebook comments for WordPress, which solves the problem really easily once you've filled out the settings page for the plugin — there's a handy guide for this one too.

Some people don't like commenting using their Facebook profile, so you might also consider a plugin like Disqus or IntenseDebate, which lets people pick how they log in to comment. Personally, I find it difficult to use commenting forms that employ these plugins, but lots of people like using them.

It's all a matter of preference.

If you want to sell products on your site, the most popular solution is WooThemes' very appropriately named WooCommerce. It has lots of options for how to take payment, and it also comes with some very nice-looking themes, including this very nice one called Sentient.

If you're not looking for something that complex, you can always add a link to your bigcartel store in your navigation menu using the custom links options.

Chapter Summary

And that's plugins. Now you know how to install them, as well as a couple to begin using, but there are thousands and thousands of options. You could search for a day and still not find the one you want — but just keep looking and you'll find something that suits.

Battling the Gods — Where Now?

You've made it. You're standing on top of Mount Olympus having fought the gods all the way and grappling with their mighty powers of confusion.

And yet, you've got a perfectly clear view of WordPress for whatever industry you're working in!

Then a strange feeling hits… where do you go when once you've made it to the top of the world?

The answer is simple. You just keep practicing in case some worthy hero comes your way.

There are heaps and heaps of really great resources out there to hone your WordPress skills and improve your ideas as a self- publishing journalist.

Although we wrote some code together, this book hasn't really dealt with the ins and outs of the Codex — that wasn't the point of the book.

Still, you could do with learning some of that stuff in more detail. You should take a look at some sites like WP Tuts which you can find at http://wp.tutsplus.com, where I sometimes write posts on how to do more advanced work within WordPress. There are also a lot of lessons on there for beginners and intermediate coders too, so you'll never be out of your depth.

Thanks for reading! If you're stuck on anything, you can always tweet me on @iammarcthomas or drop me an e-mail.

You're superlative!

Marc

About The Author

Marc Thomas is a journalist from Cardiff, UK. He works freelance for many publications writing about design, culture and publishing. He publishes Plastik Magazine (UK) and magazines for institutions and organisations with his business Plastik Content (http://plastikcontent.me).

You can find him on Twitter at @iammarcthomas or on his personal blog at http://thatisjustawesome.com.