Frequently Asked Questions:
Create a drop-down list of your pages in your nav bar
A few people have asked me how to create a drop-down menu of your pages in your top navigation bar area. Here’s how:
In your WP Admin area, go to “Design” => “Theme Editor” => “topnav.php”. On a blank line in the middle (depending on where you want it to go) paste in this line of code on an empty line:
<?php wp_list_pages('orderby=name&title_li=<a href="#">Pages</a>'); ?>
Then, save your changes and, assuming you have some pages written, you should have a perfectly functioning drop-down list of your pages.
NOTE: Because you’re adding another feature to the nav area, you may run out of room and get your header bumped down covering up your bio. If this happens, maybe delete one of your nav items, like the search, or follow the directions here to squeeze it in so it fits.
Related resources:
Why is my header is covering up my bio?
How do I delete the search feature, or something else from the nav area?
Questions? Instead of emailing for support, leave a comment below so everyone can benefit from any clarification.
Jared, I’ve added my pages to my dropdown. I’d like to remove the Blogroll from the topnav, which you’ve explained how to do, but I’d like to swap it out for my tags instead. I don’t understand the code enough to be able to just swap it out. Is there a way to add a menu to pick the tags?
@robin: I’m not aware of how to do this, although I’m guessing it might be possible. i would try searching the wordpress codex for template tags related to “tags”.
can I move the topnav bar under the slide show before the bio??
@Raquita: this can be done, but it is too complex for a simple tutorial. you can either a) try to hack your way through it, b) hire a web developer to modify it for you, or c) hire us to do it. if you’re interested in c) email Matt at prophotoinstall at gmail dot com and let him know what you’re looking for, and he’ll give you a price.
Jared, I just added this to my top nav bar. I was wondering if there is a way to make the font larger on the drop down screen.
@debra parker: yeah, on your stylesheet (line 224 ish) look for this chunk:
#ppt_topnav li ul a {
width: 104px;
padding: 5px 8px;
font-size: 80%;
}
change the “80%” to a higher number, or to a pixel amount like 14px. (don’t mess with the semi-colon!)
Jared,
My new categories are not showing up. The drop down menu is showing only “uncategorized” and not any of the new ones I created. They are showing up under categories on the admin side and where I can select them when writing a post just not on my blog. I have the same code in as the one for pages with “pages” replaced with the word “categories”. It’s the code that was already there. I’ve also emptied my cache a million times. I’m not sure what I’ve done! haha
Do you have any ideas?
@Lisette Price: that’s odd. is it possible that you’re not creating new categories, but rather “child” categories? i don’t think the drop down will show child categories. check and make sure that your categories are full-fledged categories.
I’m clicking on “manage” then “categories” then “add new” and creating them that way. Is this wrong? I know I have to be doing something wrong that’s right in front of my face my face! haha
Jared,
I figured it out. I didn’t have anything posted within my categories besides the uncategorized ones. When I tested a new post and gave it a category that was already there (ie: weddings) it showed up in the drop down menu on the blog. So I’m guessing they won’t show up unless you have post marked in that category!
@Lisette Price: oh, here’s a thought – the categories won’t appear in the drop down until there are posts in that category, i think. is it possible you don’t have any posts categorized that way yet?
@Jared: whoops, you already figured that out. sorry!
Is there a way to make the main page a “home page”, so that when someone clicks on the link to a different page they can easily get back “home”?
@Lisa: i’m not sure what you mean by making the main page a “home page”.
your logo is always a link to get back to the home page of the blog
I know this might be a stupid question, but how do I add Pages?
@Melissa Koehler: go to “Write” => “Page”
ah man, I added that line of text over another line and now my nav bar is all wacked out. They are lapped over one another. The Pages tab doesn’t show either.
@Mikael: yeah, something is messed up. i can’t tell exactly what you did wrong from your source. why don’t you email me through the support tab so i can dig deeper.
I have added the drop down menu of my pages but i want to change the name to: Important Info and I want to change the names of the other links at the top as well. How do I do that?
Also, how do I add another link like blog roll – which i would like to name – inspiration?
@Julie North: just carefully edit the word “Pages” inside that code you pasted in and change to “Important Info”.
for your blogroll, just add new links under “Manage” => “Links” and put them in a new category called “Inspiration” and they will automatically appear as a new dropdown list of links.
HI,
I have tried that numerous times now and i get an error. I am able to fix the error when I retype the word Pages. Thanks, Julie
@Julie North: it might be the space that is monkeying with it. try typing ‘Important Info’ instead of ‘Important Info’ and see if that works.
I think I must be crazy because those two options look exactly the same to me. I also have tried one word changes and the same thing happens. I have tried it at least 20 times and it is not working. Could it be a problem with the fact that I added the drop down menu to the pages?
@Julie North: whoops, my text got changed, lets try again. you should type:
Is there anyway to make your top nav bar titles link to a “page”? Instead of having a drop down for the pages?
@Allison: yeah, just add in a simple link to the page’s URL like so:
<li><a href="http://www.mysite.com/blog/my-page-url">Link Text</a></li>
paste it into the middle of your topnav.php between two items.
Hi – Can you create a drop down of your ‘recent posts’ ???
- jerryr
@jerryr: yeah, just put in a line in your topnav.php file between items like so:
and you can change the “10″ to however many you want to appear.
Hi jared,
when I tried pasting your link to pages. It went to my bluehost admin??
this is the line I inserted:
contact
can you see a mistake in that. I don’t actually have a website, just the blog and I want the top link to just go to a “page” I created within wordpress.
Thank you!
Allison
oops let me try the line again:
“contact“
Ahhh… how do I post a line of text from the code?
that link is not my site at all…
let me try again:
(code before)”http://www.myblogsite.com/contact”>contact(code after)
Jarad –
For the
How do you code for the HREF A tag ? not an expert yet in PHP ?
what would the code look like the a link (example ‘Recent Posts’) with a drop down of the 10 most recent posts ?
Next question – what about blogroll (links) – I delete the code by mistake
Thanks – jerryr
ok – i figured it out:
Recent Posts
What about for the blogroll (links) ????
thanks – jerryr
@jerryr: to put your blogroll links back, paste this line of code exactly into your topnav.php between items:
<?php wp_list_bookmarks('title_before=&title_after=&category_before=li class="%class">'); ?>@Allison: allison, you have to get your exact URL for your contact page after you create it, then use that link. if that doesn’t make sense, shoot me an email through the support tab.