I need to generate a list of all Wordpress Pages and have them display in a HTML Table, that will be printed for offline use.

  • First column is Blank
  • Second column will have the Page Creation Date
  • Third column will have the last Page Modified Date
  • Fourth column will have the Page Title

However, the Pages need to be listed by menu_order and if a Page is a child of the one above it, that Page Title will need to be intended.

Basically, I need something similar to the Wordpress "All Pages" list, but in a simple table format and only the information above.

I have searched Google for several hours and have found some code snippets, but nothing has worked.

wp_list_pages will not allow me to display both Creation and Modified Dates at the same time, nor can I get the formatting I need.

get_pages is closer, but I don't know how to get the formatting and indentation of sub-pages the way I need.

UPDATE: I am able to get a Hierarchical List in exactly the order I need to, but still need to figure out how to Indent the Subpages. Within the Page Data of each page, is its original ID as well as the Parent ID. What I need to do now is indent all sub pages, so that it looks like:

    ID 3 PARENT-ID 2
    ID 4 PARENT-ID 2
        ID 5 PARENT-ID 4
    ID 6 PARENT-ID 2

Data is being outputted in that exact order.

CODE IS FROM Wp get all the sub pages of the parent using wp query - Answer Entitled "Recursively Get All Current Sub-Pages" which will return a multi-dimensional array containing all Post Data I need.

I know it is just a matter of comparing the Parent ID of the current record, and if it matches the ID of a page one level above, to then indent it... I just don't know how to do that in a simple function, where the depth of any record can be any number.

1 Answer 1


With such custom requirements it's unlikely you will just happen upon a snippet to achieve it. This is considerable chunk of customization and working with hierarchical data is always challenging.

When you are working with wp_list_pages() what is happening in background is that it compiles data and passes to instance of Walker_Page class, that extends generic Walker class and is how typically output of hierarchical data is done in WP.

wp_list_pages() can accept instance of custom walker, however putting one together takes some PHP chops. You might explore it some and extend your question with more specifics of desired output and how far you got with walker.

Otherwise you will have to build output completely from scratch.

  • I do now have code that will load all Pages (and its data) into an Array, and in the exact order I need it to be in... but what I don't know how to do is Indent the Child Pages. I have edited the original question to reflect new information. May 30, 2013 at 22:53
  • 1
    @manticlight - "I do now have code that will load all Pages (and its data) into an Array" - add that code to your question.
    – Milo
    May 30, 2013 at 23:07
  • Code has been added. May 30, 2013 at 23:32
  • If anyone is looking for the solution, it can be found here: experts-exchange.com/Web_Development/Blogs/WordPress/… as I asked the question there as well. May 31, 2013 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.