< ?php
$obj = get_queried_object();
if ('WP_Post' === get_class($obj)) {
$cellar = get_post_meta($obj->ID,'cellar_slug',true);
if (!empty($cellar)) {
$cellars = new WP_Query(
array(
'post_type' => 'post',
'numberposts' => -1,
'posts_per_page' => '3',
'cat' => '15',
'meta_query' => array(
array(
'key' => 'cellar_slug',
'value' => $cellar,
)
),
'orderby' => 'date',
'order' => 'DESC'
)
);
}
}
if ($cellars->have_posts()) : ?>
Wine(s) from the Cellar
< ?php
while ($cellars->have_posts()) :
$cellars->the_post(); ?>
< ?php the_post_thumbnail('widget-text-post-thumbnail'); ?>
< ?php endwhile; ?>
< ?php endif; ?>