WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

wp_list_pages can be a great tool for displaying a tree structure. You can specify the depth, child of, and show_date of when the page was last modified.

However, if I want to only show the date for pages that were modified in the last...24 hours say...How can I specify this?

share|improve this question
up vote 0 down vote accepted

By default the function cannot do this, but you can specify a custom walker when you call the function, and then implement your own walker:



This way you can keep the code the same, but add a check on the date of the page being walked over, and 'skip' it if it doesn't match your requirements ( or add other desirable markup etc ).






share|improve this answer
So in combining those two tutorials, I would add a filter as such: add_filter('wp_list_pages', 'my_filter_function'); ? Also, I find it strange that much of documentation on the codex is missing! Thanks for the help though! – AlxVallejo Nov 16 '11 at 19:05
no no, when you make the call to wp_list_pages, pass in a custom walker object of your own creation, and it will use that object instead fo the default to create the output. To make your walker object you copy paste the default, change its name, and add an if statement checking if the data for the current element is within the last 24 hours – Tom J Nowell Nov 16 '11 at 19:54
Got it. Thanks! – AlxVallejo Nov 16 '11 at 22:04
can you mark the answer as accepted if it got you there? – Tom J Nowell Nov 17 '11 at 0:15
By the way, do you know where the Walker_Page is located? The custom walker function extends the Walker_Page. I need to understand how that loops through each page. Currently I have wp_list_pages running with the walker executing code at each page entry (Show title + Show date modified, etc). However, I cannot get it to show the # of children in the hierarchy for that particular parent. Any ideas? Thanks. – AlxVallejo Nov 17 '11 at 19:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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