How can I list all pages within a certain parent (ID=917) and show the month and year they were published in this format:
Aug 2011
-
This is a page (link to page)
-
This is another page (link)
Jul 2011
Jun 2011
- This is another page (link)
etc etc
UPDATE:
Also, just in case, how can I just show the months that have a page within it? So from the example above, it wouldn’t show Jul.
Please don’t tell me to use posts instead of pages as that isn’t an option on the setup I have.
Ok firstly, create a php file inside your theme’s folder and give it a name that won’t clash with any of the native theme template files, archive.php, index.php etc… (give it a unique name, something like page-list-by-month.php).
Add the following code to that file.
Save the file.
Now create a page and select the Pages by Month template in the Page Attributes metabox, what you enter for the content and title doesn’t matter, though the title you give this page will determine the URL, so consider where you want this special page to appear and use a title appropriate for that.
Example title -> My Page Archive = http://example.com/my-page-archive
Once the page is created and the template has been attached, that’s it..
NOTE: Be sure to adjust the
post_parent
value in the args array and additionally be sure to add appropriate HTML where indicated(the markup will differ depending on theme so i left it out the sample).Hope that helps.. 🙂 (oh and Mark would be me – when i’m not at my regular PC)..