Forums

[resolved] How to get child of certain page (8 posts)

  1. matek12345
    Member
    Posted 3 years ago #

    Hi

    I'm new to wordpress, sorry for my english, i was looking and trying wp_list_pages but nothing works,

    I want to show childs pages of certain page, i know ID of this page, i was trying few codes and I didn't get what i wanted

    example:

    menu: A B C D

    C have childs E F G H

    I want to show E F G H only, in sidebar

    Thanks

  2. melstan1
    Member
    Posted 3 years ago #

    To show child pages in sidebar:

    Find all of your page IDs, including the ones you don't want shown. Since you have some page IDs already, I assume you already know how to find them. Then, In the Pages widget for sidebar, find the "Exclude field" and enter ID's you do not want shown.

    Hope it helps. :-)

  3. nathan12343
    Member
    Posted 3 years ago #

    Do you always want to show those child pages in the sidebar or only if you are on the parent page?

    If they are always there use this:

    <?php wp_list_pages('child_of=1'); ?>

    replace 1 with the page ID of the parent page.

    For more options on listing pages see: http://codex.wordpress.org/Template_Tags/wp_list_pages

  4. matek12345
    Member
    Posted 3 years ago #

    good idea,

    but i want to do something more complicated than just put links on sidebar, i want to edit it with css add put little images next to links so i need code, i think it's possible to do it with code, but i just can't find how

    thanks for answer

  5. matek12345
    Member
    Posted 3 years ago #

    yes this is it, i don't know why i couldn't get it sooner,

    I have just one problem with that, i want only the children of this page, and i get:

    sites
    E
    F
    G
    H

    can i somehow make that the "sites" do not appear?

  6. matek12345
    Member
    Posted 3 years ago #

    ok i get it, i just have to add title_li= now the code looks like this

    <?php wp_list_pages('child_of=63&title_li='); ?>

    thanks a lot, without your help i never would get it :)

  7. nathan12343
    Member
    Posted 3 years ago #

    Try: <?php wp_list_pages('title_li=&child_of=1'); ?>

  8. nathan12343
    Member
    Posted 3 years ago #

    Just beat me to it!! Glad it worked for you.

Topic Closed

This topic has been closed to new replies.

About this Topic