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('
');