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
menu.

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.

Advertisements
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
menus.
• 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
level.

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

Showing Pages in a Menu

Most themes start out with a menu. In fact, menus are considered so important to
the average WordPress site that most themes don’t let you remove the menu.

When you create a new WordPress site, it starts out with an automatic menu, so
named because WordPress creates it automatically.

every time you add a new page, like the “About the Practice”
page shown earlier, WordPress adds a matching link in the menu. It keeps the links
ordered alphabetically by page name.

You can exert more control over how your theme arranges the page links in a menu,
in one of two ways: You can use the ordering and grouping features described next,
or you can create a custom menu.

The ordering and grouping approach
works best if you just want to adjust the position of a few commands in the automatic
menu but you’re happy letting WordPress run the show. By comparison, custom
menus take slightly more work but pay off with far more flexibility and extra features.

Showing Pages in a Menu