WordPress.org

Forums

Display Sub-Pages on Parent-Page (7 posts)

  1. jphang
    Member
    Posted 5 years ago #

    Hi all,

    I can't seem to make my sub-pages' contents appear on my parent page.

    I've set the name of the parent page to be chuwii -> http://jphang.com/chuwii/

    And the sub-page to be starting-up -> http://jphang.com/chuwii/starting-up/

    I want to make the contents in starting-up and all other sub-pages I have to appear on the parent page, chuwii.

    I've searched the forum and found a few solutions but those only helped to show the links of the sub-pages on the parent page. I apologise that I am not proficient with coding stuff thus hope that there's more layman kind of explanations on how to get this going =D

    Thanks in advance!

  2. Mark / t31os
    Moderator
    Posted 5 years ago #

    If you're displaying the sub-pages on the page, they're not really sub-pages are they.. more like page sub-content...

    Perhaps if you can explain what you're attempting to do with the sub-pages or give a broader example of some content and how it should be on the page..

    Are you trying to do some sort of "Table of contents" structure to the page?

  3. jphang
    Member
    Posted 5 years ago #

    Hi t31os,

    Thanks for the prompt response.

    What I wish to achieve is like the main blog post, http://www.jphang.com/ , where every posts is being presented on the main page while each of them still has their own individual page.

    Is that possible?

  4. Mark / t31os
    Moderator
    Posted 5 years ago #

    Oh i see, you want to display an excerpt of the pages on the parent page, that links to the full version of those sub-pages..

    Is that correct?...

    This may be helpful....
    http://codex.wordpress.org/Function_Reference/get_pages#Displaying_Child_pages_of_the_current_page_in_post_format

  5. jphang
    Member
    Posted 5 years ago #

    Hi t31os,

    Thanks for the help. The coding on that page helped much and now the parent page, http://jphang.com/chuwii/, is showing the child pages =)

    I know I am asking for too much, but is it possible to also teach me how to add date & time, and comments field for each post?

    For Date & Time, I tried to add in the following code,

    <abbr title="<?php the_time('Y-m-d\TH:i:sO'); ?>"><?php unset($previousday); printf(__('%1$s – %2$s'), the_date('', '', '', false), get_the_time()) ?></abbr>

    to my page template coding but the Date & Time does not show up like those in the main blog, http://www.jphang.com

    For Comments field, I also tried to add in the following code to the page template but it's also not working as per the main blog

    <span class="cmt"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></span>

    Hope that you can also help me with this. Many Thanks.

    Best Regards,
    Jackson

  6. syncbox
    Member
    Posted 4 years ago #

    Can you suggest how to also retrieve and display the custom fields associated with each page?

    Much appreciated!

  7. Mark / t31os
    Moderator
    Posted 4 years ago #

    In the same way you would for a post inside the loop, see.
    http://codex.wordpress.org/Custom_Fields

    The only difference is you feed the meta function(s) the page's ID instead of a post's, it'll work just the same though.

Topic Closed

This topic has been closed to new replies.

About this Topic