From 8d7a2a1c90f101d0388001e03a4704441d60a46d Mon Sep 17 00:00:00 2001 From: Markus Ankenbrand Date: Mon, 12 Sep 2016 13:36:50 +0200 Subject: [PATCH] Add code to display Fotoalben --- functions.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/functions.php b/functions.php index 99390a6..331977a 100644 --- a/functions.php +++ b/functions.php @@ -49,6 +49,28 @@ function atravelblog_related_posts() { echo(' '); 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('

Fotoalben:

'); + echo(' '); + endif; + wp_reset_query(); } elseif($cat == 'Tour') { $urlaub = new WP_Query(array('p' => get_field('urlaub')[0])); if ($urlaub->have_posts()) :