Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress: Displaying sub-pages only for the current page

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #25692
    MrBrightside
    Participant

    I’m working on the navigation in a wordpress theme (done in the sidebar) and I can’t figure out how to make the list of pages only show the subpages for the current page and other page’s subpages not to be shown.

    thus far I’ve been trying to figure out a way to do it with: wp_list_pages(‘ title_li’ ); but to no avail

    here’s an Example:

    Pages:
    -home <— on this one
    -subpage1
    -subpage2
    -Blog
    -FAQ

    Pages:
    -home
    -Blog
    -FAQ<— on this one
    -subpage1
    -subpage2

    Pages:
    -home
    -Blog<—on this one (no subpages)
    -FAQ

    #62027

    Actually this can be achieved using just a little css – and it will work exactly as in your example too.

    Code:
    Code:
    ul#pagenavi li ul { display: none; }
    ul#pagenavi li.current_page_item ul, ul#pagenavi li.current_page_ancestor ul { display: block; }
    #62180
    MrBrightside
    Participant

    The first one only shows the subpage

    the CSS one looks like it would work but I haven’t tested that one yet,

    Thanks you both for you time =)

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.