Support » Themes and Templates » exclude current Page from

  • I’m trying to make my navigation a little friendlier by not showing a link to the page that’s currently being viewed. My navigation menu is made up of Pages. The menu is created by this code:
    <div id="banner-nav">
    <ul id="banner-nav-pages">
    <?php /* IF THIS IS NOT THE FRONT PAGE, BUT COULD BE A "PAGE" OF THE FRONT PAGE */ if ( !is_home() || is_paged() ) { ?>
    <li><a>/" title="Home: <?php bloginfo('name'); ?>">Home</a></li>
    <?php } ?>
    <?php wp_list_pages('sort_column=menu_order&title_li=' ); ?>

    As you can see from the first php line above, the theme author has figured out how to show the Home link when not on the home page. I want to do the same thing in the wp_list_pages tag.

    I’m looking here: but not understanding… There is a current_page_item tag.

    Does anyone know how I might do this?

Viewing 1 replies (of 1 total)
  • Hey Simon: If your pages don’t have any children pages, then using CSS will probably be the easiest way to solve your problem. You’re using the Simplr theme, right? This will work for that theme, default, and others perhaps. Use the CSS:

    div#sidebar ul li ul li.current_page_item {
    display: none;

    But, like I said, if your pages have children pages, that is any pages like

    • About
      • More on Me

    Then this will cause the child of pages not to display too. You can get around this by using a > with a selector, but that still means your pages won’t show up in IE.

Viewing 1 replies (of 1 total)
  • The topic ‘exclude current Page from’ is closed to new replies.