Support » Fixing WordPress » Removing links from parent Pages

  • Hi all,

    I’ve got my list of pages in the sidebar, for example:


    -Major Project

    -Innovations Project

    …etc, where the ‘-‘ represents a Page and the ‘–‘ represents one of its children. How do I make it so that the parent Pages aren’t actually links? They don’t hold any information and are simply a way of dividing up my pages into groups, so I don’t really want people to be able to click on the parents. Can anyone help me? Or is there an alternative way to do this?

    Thank you in advance!


Viewing 7 replies - 1 through 7 (of 7 total)
  • *bump*

    Anyone got any ideas at all? At the moment I’m having to create a parent page and it’s children, set the menu depth to 1, so only the parents are visible and then provide links to all my children from there. It’s hardly ideal, I just want to separate the pages with headings!

    Please help!

    Bump ! I’m looking for the same thing. I am using suckerfish dropdowns and I would like to make the page parent links inactive.

    Thank You

    oh… here is my list pages code

    <?php wp_list_pages(‘sort_column=post_author’ . ”); ?>

    is there a way to exlude just the link from page parent?

    Is this not possible to do?

    Mobster, a little patience is a big thing around here.

    Now, you can try replacing your current wp_list_pages() template tag code with the following. It performs a little PHP magic to strip link tags only from Pages with children (listed hierarchically beneath them):

    $list_pages = wp_list_pages('sort_column=post_author&echo=0');
    $list_pages = preg_replace('%(<li class="page_item">.*<ul>)%ue', 'strip_tags(\'$1\', \'<ul><li>\')', $list_pages);
    $list_pages = stripslashes($list_pages);
    echo $list_pages;

    This should extend to parent<>child Page listings of any depth, meaning if you have child Pages acting as parents to further Pages (thus generating grandchildren, great-grandchildren, etc.), each of these ‘sub’ parents will in turn be stripped of their link tag.

    “Mobster, a little patience is a big thing around here.”

    original post -Posted: 2006-03-12 18:28:58

    Considering the date of this original post and the fact I have posted this topic another time with the only response being. “Contact Suckerfish”

    I have been very patient. I don’t normally double post but, This has turned into an emergency situation sort of.

    On your reply, that worked ! I am not quite ready to start writing code like that so, my hat is off to you for your response and wonderful code !

    Thank You very much Kafkaesqui

    Well Kafkaesqui This does work but it throws my css into serious confusion. when I load it in Firefox the menu drops below the removed link.
    In IE however, the dropdown loads to the right of the removed link.

    This is the css I think controls this correct?

    #nav li ul { /* second-level lists */

    position: absolute;

    left: -999em;

    height: 15.0em;

    width: 13.0em;

    w\idth: 13.0em;

    font-weight: normal;

    border: 0px solid #E4E4E4;

    margin: 0;

    list-style: none;


    I’m having difficulty finding a work around. Do you suppose instead of removing it completely. You could help me make the parent link # instead of totally removing it.

    Thanks again !

    Here is the link:

    This shows the issue.

    The drop down appears one way in IE
    and another in Firefox.

    Who knows what it looks like in other browsers?

    I’m getting so sick and tired of adjusting code to fit these two browsers !!!

    Any help would be appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Removing links from parent Pages’ is closed to new replies.