Update query for Tagebuch entries to new relationship type
This commit is contained in:
parent
75c1967c2e
commit
32d7b85801
1 changed files with 9 additions and 4 deletions
|
|
@ -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('<div class="related-posts posts section-inner">');
|
||||
echo('<h4 style="color: white; margin-top: 20px;">Tagebuch Einträge:</h4>');
|
||||
while ( $tagebuch->have_posts() ) : $tagebuch->the_post();
|
||||
global $post;
|
||||
if($thisID == get_field('urlaub')->ID){
|
||||
get_template_part( 'content', get_post_format() );
|
||||
}
|
||||
get_template_part( 'content', get_post_format() );
|
||||
endwhile;
|
||||
echo('<div class="clear"></div>');
|
||||
echo('</div> <!-- /related-posts -->');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue