Forums

How to stop parent pages from linking (10 posts)

  1. zandebar
    Member
    Posted 3 years ago #

    Hi all

    I am a newbie to WordPress I have just be playing with it for a few days I am using 2.7.1 (latest). I am not sure if I need a plugin or need to do some changes to the code.

    I have been using the painter theme; in the menu system, it is using wp_list_pages, which is built into wordpress. The issue I have is that I've made static page with child pages. Which will form the menu for the site.

    IE Static Page 1 (parent)
    -Page 1 child 1
    -Page 1 child 2
    -Page 1 child 3
    -Page 1 child 4

    Static Page 2 (parent)
    -Page 2 child 1
    -Page 2 child 2
    -Page 2 child 3

    In menu (list_Pages) parents will show with drop down menu for child pages, so Page 1 Page2 and so forth

    The parents have clickable links which you are able to see when you hover over the link. How can you stop this so that the parent links isn't clickable?

    IE Static Page 1 parent = ?p=8 Clickable link
    -Page 1 child 1
    -Page 1 child 2
    -Page 1 child 3
    -Page 1 child 4

    Static Page 2 parent = ?p=15 Clickable link
    -Page 2 child 1
    -Page 2 child 2
    -Page 2 child 3

    Is there a plugin somewhere, or do I need to alter the list_page with some code to achive a none clickable result.

    Can anybody help please

  2. MichaelH
    Volunteer
    Posted 3 years ago #

    Maybe two instances of the template tag, wp_list_pages():

    wp_list_pages('child_of-8&title_li=Static Page 1 parent');
    wp_list_pages('child_of-15&title_li=Static Page 2 parent');

  3. mangagrl251
    Member
    Posted 3 years ago #

    use extended categories plugin, you can make a heading that isnt clickable and choose what parent/child you want under it, very useful.

  4. zandebar
    Member
    Posted 3 years ago #

    Thanks; thats intresting I will have a look at both I will try the hard coding cheers for that MichalH.

    But the plugin looks OH so very appealing just for an out of a box solution. Thankyou mangagrl251 - I will give that a blast.

    TY

  5. MichaelH
    Volunteer
    Posted 3 years ago #

    @mangagrl251 - please provide a link to that plugin. Thank you.

  6. zandebar
    Member
    Posted 3 years ago #

    Michael I believe that this is the link for that plugin;
    http://wordpress.org/extend/plugins/extended-categories-widget/

    I have tried it, looks good but sadly doesn't do what I want it to do.

    I have tried your suggestion; works and does exactly what you said it would. I am at the moment reading up on the http://codex.wordpress.org/Template_Tags/wp_list_pages page

    As I have modified the painter theme and wanting to remove the linking parents. My PHP knowledge isn't that great and I am at the learning stage, so please forgive me.

    Your suggestion works, but I find that the style is not applied and the drop down menu works too fast. I get the feeling that I have other areas to modifiy.

    Any pointers ?

  7. zandebar
    Member
    Posted 3 years ago #

    I have been using the painter theme located here: http://wordpress.org/extend/themes/painter

    In the header.php this is the remark for the list_pages call
    <?php wp_list_pages('depth=2&title_li='); ?>

    Michaels recommendation of
    wp_list_pages('child_of-8&title_li=Static Page 1 parent');
    wp_list_pages('child_of-15&title_li=Static Page 2 parent');

    works but as mentioned above loses formatting(css, I presume, but can't see why) and dropdown menu timings are too quick. Am puzzled as to why this changes has made such a behaviour change.

    I am happy calling each parent if need be in the header.php, but would like some help and afew pointers if anybody can help.

    I am learning PHP and only a beginner, as with wordpress. I kind of have my answer now its just making it work.

    In hope

  8. zandebar
    Member
    Posted 3 years ago #

    MichaelH, can you give me any pointers as to why the drop down menu collaspes. When you lose focus on the main parent title ?

    using your > wp_list_pages('child_of-8&title_li=Static Page 1 parent');
    suggestion

    I used it like this >><?php wp_list_pages('child_of-6&title_li=');?> and its the same, give it a title and it does the above.

  9. zandebar
    Member
    Posted 3 years ago #

    The intresting thing is, thats its doing what I am asking it to do list child pages of parent. But the drop down menu fuction is not working.

    So am wondering what have I missed ?

  10. MichaelH
    Volunteer
    Posted 3 years ago #

    Not sure if this is the problem but my code says "child_of-" and that should be "child_of=" (equal sign, not minus sign). Sorry.

Topic Closed

This topic has been closed to new replies.

About this Topic