WordPress.org

Ready to get started?Download WordPress

Forums

Removing Menu Items (2 posts)

  1. snewham
    Member
    Posted 7 years ago #

    I'm not sure if this is the right section. I think and hope that it is :D sorry if it isn't though.

    Anyway, I have a few pages within my blog that I do not want displayed in the top header bar of the site. Now I've looked at a few solutions to this problem but I don't really know what I'm doing so I'd just like to ask for a few ideas from you.

    This is my navigation part within my header.php file in my theme.

    <!-- navigation ................................. -->
    <div id="navigation">

      <li<?php if (is_home()) echo " class=\"selected\""; ?>>">Home

      <?php
      $pages = get_pages();
      if ($pages) {
      foreach ($pages as $page) {
      $page_id = $page->ID;
      $page_title = $page->post_title;
      $page_name = $page->post_name;
      if ($page_name == "archives") {
      (is_page($page_id) || is_archive() || is_search() || is_single())?$selected = ' class="selected"':$selected='';
      echo "<li".$selected.">Archives\n";
      }
      elseif($page_name == "home") {"";
      }
      elseif($page_name == "about") {
      (is_page($page_id))?$selected = ' class="selected"':$selected='';
      echo "<li".$selected.">About\n";
      }
      elseif ($page_name == "about_short") {/*ignore*/}
      else {
      (is_page($page_id))?$selected = ' class="selected"':$selected='';
      echo "<li".$selected.">$page_title\n";
      }
      }
      }
      ?>

    </div>
    <!-- /navigation -->

    Any help would be much appreciated

  2. snewham
    Member
    Posted 7 years ago #

    Just to clarify, all of the pages that I don't want displayed are child items so maybe there is some kind of nagivation bar plugin out there that can create a drop down from the parent which then displays the child items?

    I just don't need all these links in the title bar :D

    my site is: http://www.scottnewham.co.uk

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags