Wordpress: Hide subpages unless on 'page'

2 replies
  • WEB DESIGN
  • |
I tried to find the answer searching google but I failed. I think what I want to do is probably really really easy, but I'm not sure how!

I have a wordpress page which I basically use as a static page rather than blog style. Anyway I have a page called "Articles" and I have subpages under it which are the articles. (one sub page for each article)

I want the sub-pages to only be visible in the side bar once someone has clicked "Articles", not from the main page. Having all the article sub-pages visible from the main page is too messy and makes the page overwhelming with the number of things to click on.

So how can I stop my sub-pages appearing in the side bar until people click on the parent page?

Thank you for any help!
#hide #page #subpages #wordpress
  • Profile picture of the author nextebizguy
    You'll need to add some conditional logic. You want to check for the page name and if that page is being displayed, then display the subpages.

    Check out this link:Conditional Tags WordPress Codex

    Look for the section about Pages and the is_page tag.
    {{ DiscussionBoard.errors[1332871].message }}
  • Profile picture of the author ForeignProfessor
    Thank you. I guess I've got to go learn something now =)
    {{ DiscussionBoard.errors[1335608].message }}

Trending Topics