get_pages and exluding children
-
I’m trying to build a portfolio in my theme where I have a page template for “Portfolios” in which all child pages (individual portfolios) are listed. This works fine, except now by client wants to add sub-portfolios. I intend on just adding grandchild pages, but this doesn’t work with my template for the main Portfolio page. Here is how I am calling the child pages of “Portfolio” in its template…
<?php $parentID = 15; $pages = get_pages("child_of=$parentID"); foreach($pages as $child) { $thumbURL = get_post_meta($child->ID, 'portfolio_thumb', true); $portname = get_the_title($child->ID); $portlink = get_permalink($child->ID);?>
I have already looked at using the exclude_tree aspect of get_pages, but it also takes away its parent portfolio from the loop, which I still need. I obviously need the child portfolio name to be queried within the loop so that there is access to the sub-portfolios, but am unsure how to do this.
Any suggestions on how to do this? Am I drastically overlooking something?
- The topic ‘get_pages and exluding children’ is closed to new replies.