Why Your WordPress Site Needs a Community

Once upon a time, people thought comments belonged only
in personal blogs and discussion forums. Serious-minded web
publishers ignored them. Small business avoided them—after
all, if people really needed to get help or make their opinions
known—well, that’s what email was for, right?
Today, the website landscape has changed dramatically. Web
commenting is an essential ingredient for sites small and
large, fun and serious, casual and moneymaking. Here’s what
a comments section can do for you:
• Attract new visitors. New visitors immediately notice
whether a website has a thriving conversation going on
or just a single lonely comment. They use that to evaluate
how popular a website is. It’s crowd mentality, working
for you—if new visitors see that other people find a topic
interesting, they’re more likely to dive in to check out your
content for themselves.
• Build buzz. If you’ve taken to the Web to promote
something—whether it’s a new restaurant, a book, a
community service, or whatever—you can only do so
much to persuade people. But if you get your fans talking
to other people, the effect is exponential. Comments help
you spread the word, getting your readers to talk up your
products or services. And once they’re talking on your
blog, it’s just a short hop away for other bloggers to post
about you on their blogs.
• Build loyalty. A good discussion helps make a site sticky—
in other words, it encourages people to return. Put another
way, people may come to your site for the content, but
they stay for the comments.
• Encourage readers to help other readers. Often, readers
will want to respond to your content with their own
comments or questions. If you ask them to do that by
email and your site is popular, you readers will easily
overwhelm you. But with comments, your audience
can discuss among themselves, with you tossing in the
occasional follow-up comment for all to see. The end result
is that your site still has that personal touch, even when
it’s big and massively popular.
Allowing or

Why Your WordPress Site Needs a Community


up to this point, you learned to create the two most
essential ingredients of any WordPress site, posts and pages. They’re the vehicles
for your content—the way you’ll reach friends, potential customers, or hordes of
devoted readers.
Still left to explore is the WordPress commenting system, which is a keenly important
part of almost every WordPress site, whether it’s a chatty blog or a buttoned-up
business website. Used properly, comments can change your site from a one-way
lecture to a back-and-forth conversation with your readers or customers. Commenting
isn’t just a fun way to make friends—it’s also a serious tool for promoting
your work, getting more traffic, turning casual browsers into repeat visitors, and
even making money.

Allowing or Forbidding Comments

If you haven’t changed WordPress’s factory settings, all your posts and pages already
support comments. You’ve probably already noticed that when you view an individual
post or page, there’s a large “Leave a Reply” section just below your content.
But it doesn’t always make sense to allow comments on everything you publish.
Many static pages don’t lend themselves to discussion. You probably won’t get a
great conversation going on an About Us or Our Location page, for example, so it
makes sense to disable comments for these pages and let people have their say
somewhere else.
Posts usually allow comments, but you might want to disable them if you write on
a contentious subject that’s likely to attract an avalanche of inflammatory, insulting,
aggressive, or racially charged feedback. News sites sometimes disable comments
to avoid legal liability (for libelous comments someone posts, for example, or for
trade secrets someone reveals). Allowing comments on posts or pages isn’t an
all-or-nothing decision—you can pick and choose what content allows comments.

NOTE Comments apply equally to posts and pages. For convenience, most of the discussion in this chapter
refers to posts, but everything you’ll learn applies equally to pages.

Changing Comment Settings for a Post

You can turn off comments for an individual post or page by changing the comment
settings when you create or edit that post or page. However, WordPress usually
hides the settings. To see them, you need to click the Screen Options button in
the top-right corner of the Add New Post or Edit Post page, and then turn on the
checkmark next to Discussion. This adds a Discussion box to your post-in-progress,
which offers just two settings.

Changing the Default Comment Settings Site-Wide

To create a site that’s mostly or entirely comment-free, you probably don’t want to
fiddle with the Discussion settings for every post. Instead, you should create a universal
setting that applies to all new posts and pages. Choose Settings→Discussion
on the dashboard, and then turn off the checkmarks next to “Allow link notifications
from other blogs (pingbacks and trackbacks)” and “Allow people to post comments
on new articles.” Then scroll down to the bottom of the page and click Save Changes.
Now all new posts and pages will be comment-free. You can add the comment feature
back to specific posts or pages by turning on “Allow comments” in the Discussion
There are many more options in the Settings→Discussion page that change the way
comments work.

The Life Cycle of a Comment

The easiest way to understand how WordPress comments work is to follow one
from its creation to the moment it appears on your site and starts a conversation.
Depending on how you configure your site, comments travel one of two routes:

The slow lane. In this scenario, anyone can leave a comment, but you need to
approve it before it appears on the post. You can grant an exemption for repeat
commenters, but most people will find that the conversation slows down
significantly, no matter how quickly you review new comments.
The fast lane. Here, each comment appears on your site as soon as someone
leaves it. However, unless you want your website drowned in thousands of
spam messages, you need to use some sort of spam-fighting tool with this
option—usually, it’s an automated program that detects and quarantines
suspicious-looking messages.

For most sites, the second choice is the best approach, because it allows discussions
to unfold quickly, spontaneously, and with the least possible extra work on your part.
But this solution introduces more risk, because even the best spam-catcher will miss
some junk, or allow messages that aren’t spam but are just plain offensive. For that
reason, WordPress starts your site out on the safer slow lane instead.


Page Templates

you learned about the underused post format feature ,
which applies different styles to different types of posts. Pages have an analogous
feature called page templates, which change the way pages look.
Like post formats, page templates are an optional part of a WordPress theme. Your
theme may include multiple page templates or none at all..

When you create a new page, WordPress assumes that you want to use the standard
template. But switching to something else is easy. When you create or edit a page,
choose the template you want from the Template list in the Page Attributes box.
The page template feature faces the same challenge as the post format feature:
Because a theme is designed to suit a variety of sites, and because there’s no way
for a theme to understand the fine details of your site, it can’t provide templates
tailored to your content. The WordPress year themes use page templates for two
basic purposes: to control the appearance of your site’s sidebar, and to create improved
home pages. The following sections explain how to do both.

NOTE There’s one page template you won’t consider in this chapter: the Contributor Page template included with the Twenty Fourteen theme. It’s an unusual but innovative page that automatically gathers and displays author information in a site that has multiple contributors. You’ll try it out when you consider WordPress collaboration.

Pages With or Without Sidebars
With some themes, your site’s sidebar appears on every page, just as it appears
next to every post. With other themes, WordPress displays pages without the sidebar.
No approach suits everyone, and page templates let you change your theme’s
built-in preference.

NOTE If you start adding sidebars to your pages, be consistent. For example,
if you decide not to show sidebars on, say, pages with pictures or photo galleries, make sure the other pages on your site follow suit.
Otherwise, your visitors may feel that your site is unpredictable or poorly organized.

Better Home Pages
Another reason that themes use page templates is to create souped-up home pages.
These specialized pages include a spot for your static content, just like any other
page, along with some extras. The extras can include more widget areas, featured
image sliders, and a customized post list. The goal is to give you a way to create a
more attractive entryway to your site.

Here’s how WordPress assembles a showcase page for the Twenty Eleven theme:
• First, it takes your sticky posts (page 104), and adds them to the Featured
Post gallery. To include a picture alongside a featured post, make sure you set
a featured image (page 190).
• Underneath the Featured Post gallery, WordPress shows the content for the
most recent non-sticky post. If you want WordPress to show only a portion of
the most recent post, you need to use the More quicktag (page 196).
• Underneath that, WordPress lists the titles of the next four most recent posts
(not including sticky posts). To view one, your guest must click its title.
• WordPress adds a sidebar to the left side of the page, next to the list of your
most recent posts. However, this isn’t the standard sidebar you see on your
normal home page (and all the pages that use the sidebar template). Instead,
it’s called the showcase sidebar, and it appears on showcase pages only. To fill
it with widgets, choose AppearanceÆWidgets, and then drag the widgets you
want to the Showcase Sidebar area.

It might occur to you that you like the showcase page, but you want to take the
idea further. For example, maybe you want to control what posts appear in the list
of recent posts, or you want to create several showcase pages that highlight different
categories of posts, like the sections of a newspaper. Unfortunately, showcase
pages don’t give you this flexibility. However, you can begin building a system like
this if you’re running a self-hosted WordPress site and you’re not afraid to get your
hands dirty.

Page Templates

Changing Your Home Page

If the list of posts is less important on your site, or if you
want to show some sort of welcome message, or if you just want to direct traffic (in
other words, give readers the option of reading posts or going elsewhere on your
site), it makes sense to start by showing a page instead of a post.

Creating a Brochure Site

The simplest way to change your home page is to ditch the post system altogether,
using pages instead of posts throughout your site. The resulting all-pages site is
sometimes called a brochure site, because it resembles the sort of informational
pamphlet you might pick up in a store.

Should You Build a Brochure Site?
A brochure site may make sense if you’re building a small site
with very simple content. The restaurant site in Figure 7-17 is
one example.
But if you’re trying to decide between a brochure site and a
post-based site, consider two questions. First, would your site
be more attractive to readers if you included posts? Even the
bare-bones restaurant site might be more interesting with
posts that chronicle restaurant news, menu experiments,
and special events. Not only that, but the fact that posts are
frequent, dated, and personal makes the site more vibrant. In
addition, if you want to get people talking on your site—for
example, posting comments about recent meals or sending in
requests and off-the-wall recipe ideas—you’ll have more luck
if you include posts. Think of it this way: A brochure site feels
like a statement, while a blog feels like a constantly unfolding
Then again, you may decide that a brochure site is exactly
what you want. Maybe you really don’t have time to spend
updating and maintaining a site, so you simply want a place
to publish some basic information on the Web and leave it at
that. You can still take advantage of several of WordPress’s
best features, like themes, which ensure that your pages look
consistent. You’ll also get WordPress’s help if you want to track
visitors (page 444), add sharing buttons (page 412), or add any
one of a number of features described in this book.

TIP If you use a custom page for your home page, you may want to jazz it up with a few more navigational
features. Many themes provide page templates that can help you out by adding a widget-stocked sidebar beside
your page content,

Creating a Custom Entry Page

Even if you want to change your home page, you might not want to ditch the post
system. In such a case, use a static home page (called a welcome page), and include
a full complement of posts on another page.
The trick to doing this is specifying a URL for the page that displays your posts.
Here’s where things get slightly bizarre. To get the URL for your posts, you create
yet another page. This page is just a placeholder—its sole purpose is to provide the
web address for the posts page. You don’t actually need to put any content on this
page, because WordPress automatically creates the list of posts.

NOTE If you use the self-hosted version of WordPress, you need to make sure you changed your site’s
permalink setting to use post titles rather than post IDs (page 117). Otherwise, the link to your placeholder page
will use the post’s ID, not its name. This is terribly confusing—it means you’ll end up with a permalink with a
name like http://magicteahouse.net/?p=583 that actually shows your list of posts.

Even though you created a posts page, that doesn’t mean your visitors know
about it. They need a way to get there, and the best option is a link in your site’s
menu. Creating that is easy—you simply add a new menu item that points to
your placeholder page.

In some cases, you may decide not to lump all your posts together in a single reverse chronological
stream. In that case, you don’t need to create the placeholder page.
Instead, you can add category links to your menu so that visitors browse all the
posts that fall into a particular category.
This is a great approach, but it may become less practical if you have a lot of categories,
because you don’t want to burden your site with a crowded, clumsy menu.
One solution—provided you have a self-hosted site—is to customize your home page
with the theme-editing tricks

Changing Your Home Page

The Custom Menu Widget

There’s one more way to display a custom menu: in the Custom Menu widget.

Menu widget looks a lot like the Pages widget, shown in Figure 7-8.
The advantage of the Custom Menu widget is that it’s more flexible than the Pages
widget. The Pages widget shows all (or almost all) of your pages, but the Custom
Menu widget shows just the pages you want and can optionally include other category
links and links to other websites, provided that you add them to your custom

TIP One nifty way to use the Custom Menu widget is to create a blogroll—a list of blogs you recommend,
blogs by people you know, or sites that have content similar to yours. For example, a cooking blog might have a
blogroll with other food-related blogs in it. All you need is a new menu (you can name it “Blogroll”), which you
can then fill with links.

The Custom Menu Widget

Custom Menus

WordPress’s ordering and grouping features give you enough flexibility to create a
good-looking, well-ordered menu. However, there are a few good reasons why most
WordPress developers eventually decide to build a custom menu:
• To get more types of menu items. An automatic menu includes links to your
pages, and that’s it. But a custom menu can include other types of links—for
example, ones that lead to a particular post, a whole category of posts, or even
another website.
• To hide pages. An automatic menu always includes all your pages. This might
not be a problem for a relatively new WordPress site, but as your site grows,
you’ll probably add more and more pages and use them for different types of
information. Eventually, you’ll create pages that you don’t want to include in
your main menu (for example, you might want to add a page that readers can
visit only by clicking a link in a post). The only way to hide a page from a menu
is to abandon the automatic menu and build a custom menu.
• To have multiple menus. Some themes support more than one home page
menu. However, a site can have only one automatic menu. To take advantage
of the multiple-menu feature, you need to create additional menus as custom
• Because sometimes automatic menus are hard. To get an automatic menu
to look the way you want it to, you need to think carefully about the order and
parent settings. If you have dozens of pages, this sort of planning can twist
your brain into a pretzel. If you build a custom menu, you can drag and drop
your way to a good-looking menu. It still takes time and work, but it requires a
lot less planning and thinking.

Building a Custom Menu

TIP It makes sense to add a link named “Home” or “Posts” to most new menus. That way, your guests always
have a way to get back to your home page. To create a home page link, choose the View All tab in the Pages box,
turn on the checkbox next to Home, and then continue with the next step.

Getting Even More Menu Links
The menu editor makes it easy to link to another page on your
site, to a category of posts, or to another website entirely. But
you can get even more menu-creating options if you click the
Screen Options button (found in the top-right corner of the
page) and turn on the Posts and Tags checkboxes.
If you do, you’ll get three more boxes for adding menu items.
The Posts box shows a list of all your posts, letting you add
a link to a specific post without needing to remember the
permalink. The Tags box is similar to the Category box—it lets
your visitors browse all the posts that have a specific tag. And
the Format box lets you add links to different post formats
, if you use the formats in your blog. For example,
you can add a link that lets readers view all the Aside posts
or all the Quote posts.

Unlike automatic menus, custom menus don’t pay attention to your pages’
order or parent settings. This is good for flexibility (because it means you can
arrange the same commands in different menus in different ways), but it also
means you need to do a little more work when you create the menu.

Creating submenus is just as convenient, once you know the trick. First, arrange
your menu items so that the child items (the items you want to appear
in the submenu) appear immediately after the parent menu item. Then, drag
the child menu item slightly to the right, so that it looks like it’s indented one

NOTE You can easily create multilayered menus (menus with submenus inside of submenus). All you do is
keep dragging items a bit more to the right. However, most well-designed WordPress sites stop at one level of
submenus. Otherwise, guests may find it awkward to dig through all the layers without accidentally moving the
mouse off the menu.

Creating a Menu Item That Does Nothing
Can I make a submenu heading that visitors can’t click?
WordPress menus work a little differently from the menus
in traditional desktop computer programs. When you have a
submenu in a desktop program, you click the parent menu item
to open the submenu, and then you click one of the items inside
the submenu. But in WordPress, you just point to the parent
menu item to open it. The parent item is still a real menu item
that leads somewhere—if you click it, you go to a new page,
category, or custom URL.

But perhaps this isn’t the behavior you want. To create an
unlinked heading, add a new command
from the Links box, set the label and then set the URL to #
(the number sign character—that’s
all). To browsers, the # symbol represents the current page, so if
you click the menu item ,
you won’t go anywhere. In fact, you won’t even see the page
flicker, which is exactly what you want.

Multiple Menus

Many themes support more than one menu.

You can imagine using these menus for distinctly different tasks—using the
top menu to navigate the whole site, for example, the side menu to drill into specific
posts or categories, and the bottom menu to link to other sites with related content.

NOTE You don’t need to use all the menus a theme provides. Initially, WordPress creates an automatic menu
and uses it as the theme’s primary menu. Any additional menus start off hidden, and appear only if you attach
custom menus to them.

Custom Menus

Ordering Pages

Often, when you display a list of pages, you want to dictate which ones show up
first and which ones are last. You can do this by typing in a number for the Order
setting, which appears in the Page Attributes box when you create (or edit) a page.
The Order setting affects the order of your pages in two situations: when you display
pages in an automatic menu and when you display them in the Pages widget with
the “Sort by” box set to “Page order.”
Ordinarily, WordPress sets the order number of every page to 0. Technically, that
means that each page is tied for first position, and the page order setting has no
effect. But if you want to set the order (say you want “Our Story” followed by “Our
Location” followed by “Contact Us”), you’d assign these pages steadily increasing
page-order numbers (say, 0, 1, and 2). The actual numbers don’t really matter—the
important thing is how they compare. WordPress always displays larger-numbered
pages toward the bottom of the list or on the right end of a horizontal menu, with
smaller-numbered pages closer to the top of a list or to the left of a menu bar. If two
or more pages have the same order value, WordPress orders them alphabetically.

TIP If you rearrange a bunch of pages, you need to change their page-order values. The easiest way to do
that is to go to the Pages list (choose Pages→All Pages), point to a post, and click the Quick Edit link. This way,
you can quickly modify some page information, including the order, without opening the whole page for editing.
There’s another way to group pages: You can designate some as child pages that
belong to a specific parent page. (You may have used this type of organization
before, to create subcategories for your posts.) To create
this hierarchy, you set the Parent setting in the Pages Attribute box when you
create or edit the page.

The order settings create the nicely styled menu and nested list .
The menu displays subsidiary pages in submenus, while the Pages widget slightly
indents nested pages.

Life can get a bit confusing when you order and group pages. Just remember that
when WordPress orders pages, it compares only the pages at the same level. For
example, you can use the page order to adjust the position of the Assault Charges,
Drug Offenses, Family Law, and Personal Injury Defense pages with respect to one
another. However, WordPress won’t compare the order values of the Family Law
and Legal Disclaimers pages, because they aren’t at the same level and won’t ever
be shown next to each other.

Ordering Pages