WordPress.org

Forums

Removing links from parent Pages (8 posts)

  1. asphaltcowboy
    Member
    Posted 9 years ago #

    Hi all,

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

    -Tools
    --Scripting

    -Major Project
    --Environment
    --Storyboard

    -Innovations Project
    --Report
    --Product

    ...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!

    Regards,
    Daniel

  2. asphaltcowboy
    Member
    Posted 9 years ago #

    *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!

  3. Mobster
    Member
    Posted 8 years ago #

    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?

  4. Mobster
    Member
    Posted 8 years ago #

    Is this not possible to do?

  5. Kafkaesqui

    Posted 8 years ago #

    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):

    <?php
    $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.

  6. Mobster
    Member
    Posted 8 years ago #

    "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

  7. Mobster
    Member
    Posted 8 years ago #

    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 !

  8. Mobster
    Member
    Posted 8 years ago #

    Here is the link:

    http://saundersandcompany.com.c1.previewmysite.com/index.php

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic