troyco85
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Display pages child with certain custom fieldOk, so i found a non elegant solution…
$children = get_pages( array ( 'child_of' => $post->ID, 'depth' => -1, ) ); foreach($children as $child) { // Get the meta values from the child page $shortdesc = get_post_meta($child->ID, 'short-description', true); $photo = get_post_meta($child->ID, 'product-photo', true); $price = get_post_meta($child->ID, 'price', true); $category = get_post_meta($child->ID, 'category', true); $title = get_the_title($child->ID); if($category == value) { // Display the meta values echo ' <Output Code goes here> } } ?>
Basically retrieved all the pages and use an if statement to hide all the pages I don’t want.
I’l have to come back to this issue in the future but for now it’s got me out of a massive jam. ??
Forum: Fixing WordPress
In reply to: Display pages child with certain custom fieldStill attempting it. Man, I feel like I’m so close and it will be something obvious.
I tested out your meta_query and it seems that it doesn’t get used at all (i.e. I can change the key, value, compare to anything and it won’t change the outcome).
I haven’t lost hope yet though haha!
Forum: Fixing WordPress
In reply to: Display pages child with certain custom fieldyeah, looks like you’re onto something there… I’ll put a portion of my genius towards it and I’ll definitely let you know how I go!
Thanks soo much!
Forum: Fixing WordPress
In reply to: Display pages child with certain custom fieldThanks egado for an amazingly quick response!
I quickly threw it in and it’s definitely getting the children pages but for some reason its still bringing every child in… I love the array approach though!