WordPress.org

Ready to get started?Download WordPress

Forums

listing pages and other info in Page Template (4 posts)

  1. jacynrebekah
    Member
    Posted 6 years ago #

    Okay I want to show a list of pages (subpages), below the entered text in a Page Template.

    Right now I am using:

    <?php wp_list_pages('title_li=&child_of=5&show_date=modified&date_format=F j, Y'); ?>

    Which calls the page title and date so it looks like:

    Music Review September 25, 2007

    I would like it to also call the author name and some other text so it looks like:

    Music Review by AuthorName, September 25, 2007

    I tried adding 'show_author' or 'the_author' between the title and the date, but I get nothing.

    I'd like the list to sort by last modified date as well.

    I swear, I am going to finish these last few changes to my template, and then go learn something about PHP so I can do this better in the future. The Codex helps a lot, but I keep getting confused about the order the code needs to call things in and where exactly to put the code.

  2. jacynrebekah
    Member
    Posted 6 years ago #

    Anyone?

  3. adamrice
    Member
    Posted 6 years ago #

    wp_list_pages has no provision for displaying the author's name. It should be possible to sort this by date modified by using

    <?php wp_list_pages('title_li=&child_of=5&show_date=modified&date_format=F j, Y&sort_column=post_modified&sort_order=desc'); ?>

    You may want to make sort_order=asc instead.

    To get the author name in there, you'd need to write a custom function, which is more than I can come up with off the top of my head. As far as I can tell, the only way to obtain the author name using tags that only function inside the loop. So this function would need to get the ID of the page in question, start a loop for that page ID, and then construct your desired output string.

  4. jacynrebekah
    Member
    Posted 6 years ago #

    Thanks, Adam, I've got it sorted now. :) Although it sounds like getting the other info in there is outside the scope of my capabilities.

Topic Closed

This topic has been closed to new replies.

About this Topic