Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter troyco85

    (@troyco85)

    Ok, 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. ??

    Thread Starter troyco85

    (@troyco85)

    Still 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!

    Thread Starter troyco85

    (@troyco85)

    yeah, 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!

    Thread Starter troyco85

    (@troyco85)

    Thanks 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!

Viewing 4 replies - 1 through 4 (of 4 total)