WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How do you list a single page title? (5 posts)

  1. Jayjerome
    Member
    Posted 7 years ago #

    I know how to echo all the page titles listed in the Page Index:

      <?php wp_list_pages('title_li=' ); ?>

    but if I only want to show a specific page and its subpages, is there a ?php code to do that?

  2. onocrotalus
    Member
    Posted 7 years ago #

    If you don't have lots of pages, you could just add an exclude argument and block all pages from being shown except the one you want. An example is here.

  3. Jayjerome
    Member
    Posted 7 years ago #

    onocrotalus,

    Thanks for the suggestion, but I think it’s going to be cumbersome to use the 'exclude statement.'

    First, I have to create a custom page template for each ‘special’ page I want to display and add the exclude statement to it. And then go and create the page in the administration section.

    Although I’m planning on about a dozen ‘special’ pages, if I only had to write the exclude statement one time for each new template, that's manageable.

    But once I set up those pages, each time I create new pages won't I have to go back to each template and update the ‘exclude statement’again?

    That may be too high-maintenance. What I’d really like to find is code I can add to the default page.php file that says something like: “when a page is displayed, only show it’s title and sub-pages, ignore all others.”

    Is that feasible?

  4. Kafkaesqui

    Posted 7 years ago #

    I believe this thread covers what you're looking to do:

    http://wordpress.org/support/topic/89781

  5. Jayjerome
    Member
    Posted 7 years ago #

    Kafkaesqui: that's exactly what I needed. Thanks so much for the brilliant code!!!!!

Topic Closed

This topic has been closed to new replies.

About this Topic