218 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Located in Canada
+4 more
simonbouchard says

I need a hand to create a custom loop with WP3 . The situation is the following:

  • We load a page (Car Listing Page) that is listing all sub pages (Models) by including some details of each car models (Model Name, Post Thumbnail, Custom Fields, etc…) – This part is coded and working.
  • Then, I want in each listing, displaying the sub-pages of those sub-page.

Code

http://www.nomorepasting.com/getpaste.php?pasteid=33927&seen=true&numbered=on&langoverride=php

So into the div with a class of “links”, I need to list the child pages of each listing. Didn’t find anything good on Google and Codex with this scenario.

2459 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $100+ on Envato Market
  • Has referred 100+ members
  • Has been a beta tester for an Envato feature
+3 more
digitalimpact says

I think you’d need a separate loop for those grandchild pages; or try to adapt this, found it on the WP forums.

Anyway, why aren’t you using custom post types/taxonomies? Looks like an ideal scenario for this…

218 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Located in Canada
+4 more
simonbouchard says

There is a problem for using post types : I need to use Pages for displaying these cars because they have children pages (Features, Technical Specs, Gallery, etc). If it was only a listing of car models, it’s ok, but I need to have each car pages linked to other child pages.

284 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
+3 more
Shellbot says

I might be missing something obvious but can’t you just reuse the code that got the child pages, using the child page ID, to find the grandchild pages?

Sorry if that’s stupid, I’m just glancing here on my way to go do the washing up…

218 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Located in Canada
+4 more
simonbouchard says
I might be missing something obvious but can’t you just reuse the code that got the child pages, using the child page ID, to find the grandchild pages? Sorry if that’s stupid, I’m just glancing here on my way to go do the washing up…

Hehe, I was just coming here to say that I’ve found the solution and you guest it right!

<div class="links"> <?php $children = wp_list_pages('title_li=&child_of='.$pageChild?>ID.'&echo=0'); if ($children) { ?> <ul class="links"> <?php echo $children; ?> </ul> <?php } ?> </div>
284 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
+3 more
Shellbot says

Ah glad you got it sorted! It seems like a bit of a complicated way to go about things though, you’re going to end up with a lot of pages :S

218 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Located in Canada
+4 more
simonbouchard says
Ah glad you got it sorted! It seems like a bit of a complicated way to go about things though, you’re going to end up with a lot of pages :S

No choice, I need a page for showcasing (listing) all car models, each cars then have their own overview, features, technical specs and gallery pages ; including a stores locator and quote request. It’s a heavy customized template -> http://twitpic.com/2c9no1

by
by
by
by
by
by