WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Display a specific page and its sub pages on main page (4 posts)

  1. Steve
    Member
    Posted 2 years ago #

    I'm trying to display specific wordpress pages and their sub pages on a section of my main page.

    At the moment my structure is:
    Main Page
    Service Page
    -Service Type 1
    --Service Type 1, Item 1
    --Service Type 1, Item 2
    -Service Type 2
    --Service Type 2, Item 1
    --Service Type 2, Item 2

    I know how to list my "services types" on my "services page", but I'm having trouble trying to display the pages and then there sub pages from my main page template.

    I would like to display the title of my "services type" pages and then list the sub services underneath. Something similar to http://osc4.template-help.com/zencart_28828/index.php?main_page=index

    In the upper grid images in the above link, I would like to have my services title and then a list of the services I offer.

    I'm pretty sure I have to enter a specific page ID but I'm unsure were to begin.

    Any help would be great.

  2. Steve
    Member
    Posted 2 years ago #

    I found a way of getting a basic list of the pages and their sub-pages by using:

    <?php wp_list_pages('include=453&title_li='); ?>
    <?php wp_list_pages('child_of=453&sort_column=post_title&title_li=') ?>
    <?php wp_list_pages('include=457&title_li='); ?>
    <?php wp_list_pages('child_of=457&sort_column=post_title&title_li=') ?>

    My skills in php are basic at best, can anyone help with the above?
    It doesn't seem to be the correct way of doing what I'm looking for.

    I would like to use css to edit the titles and the children above and rather than repeat code can I use a loop to do this??

  3. Steve
    Member
    Posted 2 years ago #

    So after a few hours of searching I haven't been able to find what I'm looking for.

    I'm trying to make an array of page ids and display the titles of these pages.

    Then I want to search the array and see if the pages in it have children and if so display the child titles underneath as links (following my css).

    It doesn't sound to difficult but I can't seem to get my head around it. I have been mashing code together but cant figure it out.

    Anyone got any suggestions?

  4. Steve
    Member
    Posted 2 years ago #

    Turns out instead of listing pages and sub pages it was easier to create a new menu in order to achieve what I was trying to get.

    I used the code here to make the second menu:

    http://wordpress.org/support/topic/on-adding-second-menu-to-twenty-eleven?replies=4

    I had a problem with the 'home' page appearing in the second menu so I used the function found here to remove it:

    http://wordpress.org/support/topic/remove-home-from-menu-1?replies=9

Topic Closed

This topic has been closed to new replies.

About this Topic