• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WPArena

WPArena

WPArena is a premium online resource site of WordPress and is focused on providing excellent WordPress Tutorials, Guides, Tips, and Collections.

  • News
    • Opinion
  • Tutorials
  • Reviews
    • Themes
    • Plugins
  • Comparisons
  • Collections
    • Education Themes
    • Genesis Child Themes
    • Best Responsive Themes
    • Medical WordPress Themes
    • Finance & Business Themes
    • Crowdfunding Themes
  • Resources
    • Inspiration
  • Services
WPArena » Tutorials
Tutorials

How to Display Specific Pages/Links in WordPress Navigation Menu

Avatar of Editorial Staff Editorial Staff February 22, 2008

specific menu items
FacebookTweetPinLinkedInEmailPrint

If your WordPress blog has a navigation or top menu bar that shows all your WordPress pages and you create a lot of pages this can become quite cluttered. You can change this to specify the pages or links displayed from within your WordPress themes template files. This WordPress guide shows how to specify WordPress navigation page links.

First, your themes files will need to be writable in order to edit them from within the WordPress dashboard or you will need to edit the file and upload it with an FTP client. Another option is to edit the file in the hosting account file manager or make the theme’s files writable. From within the WordPress dashboard click Presentation or Appearance and then the Theme Editor. On the right side of the theme editor click, Header to open the header.php file. Depending on your theme you should see some code that looks like this:

    <div id="top-menu">
    <ul>
    <li><a <?php if (is_home()) echo('class="current" '); 
 ?>href="<?php bloginfo('url'); ?>">Home</a></li>
    <?php wp_list_pages('depth=1&title_li='); ?>

    </ul> </div>

The code in the parentheses after wp_list-pages is showing all pages you create and doing so can cause that list to grow quite large. You can just remove that code and hard code the actual pages you want in that area.

If you are a not familiar with editing WordPress themes make sure to copy all the code in the file and save it so you can restore any mistakes you might make!

Now just remove the bit of code in reading and replace it with a regular HTML formatted code like this:

    <div id="top-menu">
    <ul>
    <li><a <?php if (is_home()) echo('class="current" ');
    ?>href="<?php bloginfo('url'); ?>">Home</a></li>
    <a href="http://www.TheURL.com/" title="Page
    Title Here">Page Title Here</a>
    <a href="http://www.TheURL.com/" title="Page
    Title Here">Page Title Here</a>
    </ul> </div>

If you copy the above code to use it on your site and doesn’t work check for the proper format of all the quotes ” I tried to format them so they come through properly but may have missed one! To replace the curly quotes ” with regular ones just remove them and simply retype them again.

Now you can specify the exact page, or any URL for that matter simply by hard-coding it directly into your WordPress header.php file.

FacebookTweetPinLinkedInEmailPrint

Related Stories

  • The Most Common WordPress Errors with Their Solutions

    The Most Common WordPress Errors with Their Solutions

  • How to secure your WordPress images and content from Theft

    How to secure your WordPress images and content from Theft

  • How To Make A Mobile Friendly WordPress Blog

    How To Make A Mobile Friendly WordPress Blog

Avatar of Editorial Staff

Editorial Staff

Editorial Staff at WPArena is a team of WordPress experts led by Jazib Zaman. Page maintained by Jazib Zaman.

Reader Interactions

Share Your Thoughts Cancel reply

Before submitting your comment, we kindly ask that you read our comment policy. Your email address will remain confidential and will not be published or shared anywhere. If you subscribe, you will receive notifications regarding new comments.

Primary Sidebar

WordPress Post Navigation Looks Bad On Single Pages

reduce comment spam

Why Your WordPress Comments Are Not Showing up

Recent Topics

  • 27 Top SEO Companies in the World
  • 12 Ways To Monetize Your WordPress Blog
  • Comparing the Best Employee Engagement Software in the Market
  • Stellar Converter for OST Review: Best Tool for OST to PST Conversion
  • How To Use WordPress as an eCommerce Store

Footer

Top

  • Services
  • Our Themes
  • Facebook
  • Twitter
  • Linkedin

Reviews

  • Beaver Builder Review
  • Beaver Themer Review
  • WP User Frontend Pro
  • Ninja Forms Review
  • MemberPress Review

More Reviews »

Resources

  • Best WordPress Plugins
  • WordPress Permalinks Structure
  • Email Management System
  • Envato Free Files
  • Advertise
  • Write for us
  • Disclosure
  • Terms
  • Privacy
  • Contact

Copyright © 2023 · All Rights Reserved · WPArena is a Project of TechAbout LLC.
We are not affiliated with Automattic or WordPress.

  • Advertise
  • Write for us
  • Disclosure
  • Terms
  • Privacy
  • Contact
Share this ArticleLike this article? Email it to a friend!

Email sent!