Add code to display Fotoalben

This commit is contained in:
Markus Ankenbrand 2016-09-12 13:36:50 +02:00
parent aaea44db9c
commit 8d7a2a1c90

View file

@ -49,6 +49,28 @@ function atravelblog_related_posts() {
echo('</div> <!-- /related-posts -->');
endif;
wp_reset_query();
$album = new WP_Query( array(
'category_name' => 'Album',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'urlaub', // name of custom field
'value' => get_the_ID(), // matches exaclty "123", not just 123. This prevents a match for "1234"
'compare' => '='
)
)
) );
if ($album->have_posts()) :
echo('<h4 style="color: white; margin-top: 20px;" class="section-inner">Fotoalben:</h4>');
echo('<div class="related-posts posts section-inner">');
while ( $album->have_posts() ) : $album->the_post();
global $post;
get_template_part( 'content', get_post_format() );
endwhile;
echo('<div class="clear"></div>');
echo('</div> <!-- /related-posts -->');
endif;
wp_reset_query();
} elseif($cat == 'Tour') {
$urlaub = new WP_Query(array('p' => get_field('urlaub')[0]));
if ($urlaub->have_posts()) :