Add code to display Touren for each Urlaub
This commit is contained in:
parent
8d7a2a1c90
commit
63f784acf5
1 changed files with 22 additions and 0 deletions
|
|
@ -71,6 +71,28 @@ function atravelblog_related_posts() {
|
|||
echo('</div> <!-- /related-posts -->');
|
||||
endif;
|
||||
wp_reset_query();
|
||||
$touren = new WP_Query( array(
|
||||
'category_name' => 'Tour',
|
||||
'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 ($touren->have_posts()) :
|
||||
echo('<h4 style="color: white; margin-top: 20px;" class="section-inner">Touren:</h4>');
|
||||
echo('<div class="related-posts posts section-inner">');
|
||||
while ( $touren->have_posts() ) : $touren->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()) :
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue