WordPress gurus
- Started
- Last post
- 10 Responses
- raf
I have this page structure in WP:
– parentpage1
–– child1
–– child2
–– child3
–– child4
– parentpage2
–– child1
–– child2
–– child3
–– child4There are 2 parent pages, but number of child pages might vary in future as client has control over their creation.
I need parent pages to be automatically generated landing pages, displaying each of its child's title and excerpt.
I know pages have no excerpts in WP (only posts) but I'd either use custom fields or a plugin to solve that.How do I go about scripting landing pages to be created from excerpts of their children?
I contemplated using posts instead of pages for that but it might be a bit confusing for the client - not to mention problems with setting posts' order.
- acescence0
something like this...
- dropdown0
I tried finding a solution to this while back and gave up. Ended up going with posts, but presumably you could do a mixture of the two. Keep the parent page as pages, and the children could be posts with the category of their respective parents. It would take a little more work on the nav but it may work for ya.
Then just make a template for each parent page that pulls the excerpt from each post in that category like so:
- raf0
Thanks guys! Ascence's solution seems to lead somewhere, but it lists all pages' titles, parent or child instead of this particular parent page's children.
- acescence0
oh sorry, i seem to have invented a parameter that doesn't exist... you'll have to write a custom query, hold on...
- acescence0
no wait, i think that should work. notice that in the first bit, you'll have to change that to check for the actual id's of whatever the parent pages are.
- raf0
It works when I put the id there, ie.
if(is_page('6')) :
$parent_id = 6; //id of parent pageThe titles come in reverse order, is there a way to sort them the way the pages are ordered?
- raf0
orderby=menu_order&order=ASC did it!
- raf0
You're ace, acescence! So are dropdown and neverblink, thank you all!