From 32d7b85801629040568986ccf0be60a96196bd56 Mon Sep 17 00:00:00 2001 From: Markus Ankenbrand Date: Mon, 12 Sep 2016 13:12:20 +0200 Subject: [PATCH] Update query for Tagebuch entries to new relationship type --- functions.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/functions.php b/functions.php index 5aafeb5..2025e8e 100644 --- a/functions.php +++ b/functions.php @@ -29,16 +29,21 @@ function atravelblog_related_posts() { if ( $cat == 'Urlaub' ){ $tagebuch = new WP_Query( array( 'category_name' => 'Tagebuch', - 'posts_per_page' => -1 + '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' => 'LIKE' + ) + ) ) ); if ($tagebuch->have_posts()) : echo(' ');