• Resolved matek12345

    (@matek12345)


    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

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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. ??

    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: https://codex.www.ads-software.com/Template_Tags/wp_list_pages

    Thread Starter matek12345

    (@matek12345)

    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

    Thread Starter matek12345

    (@matek12345)

    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?

    Thread Starter matek12345

    (@matek12345)

    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 ??

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

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to get child of certain page’ is closed to new replies.