I get with that code some pictures from different pages they have a special parent page.
$query = new WP_Query(
array(
'post_type' => 'page',
'post_parent__in' => array(376, 379),
'orderby' => 'title',
'order' => ASC,
'posts_per_page' => 9999
)
);
But now i want that the code not only look for parent pages but also for single pages. Is it possible to combine post_parent__in
& post__in
?
$query = new WP_Query(
array(
'post_type' => 'page',
'post_parent__in' => array(376, 379),
'post__in' => array(1148),
'orderby' => 'title',
'order' => ASC,
'posts_per_page' => 9999
)
);
If i use the second code it shows me nothing. It should look for images they are have a parent page or a specific page id.
Thx for your Help
Shortcode code:
function galerie_klassisch_wohnen() {
$query = new WP_Query(
array(
'post_type' => 'page',
'post_parent__in' => array(376, 379, 382),
'orderby' => 'title',
'order' => ASC,
'posts_per_page' => 9999
)
);
if ( $query->have_posts() ) : while($query->have_posts()) : $query->the_post();
$return_string .= '<div class="dynamische-galerie"><div class="col-3"><div class="dynamische-galerie-wrapper"><a href="'.get_permalink().'">'.get_the_post_thumbnail( $post_id, array(285,200) ).'</a><div class="dynamische-galerie-caption"><a href="'.get_permalink().'"><b>'.get_the_title().'</b><br>'.number_format(get_field( 'nettogrundflaeche' ),2,',','.').'<span> m²</span></a></div></div></div></div>';
endwhile;
return $return_string;
endif;
wp_reset_postdata();
}
add_shortcode( 'galerie_klassisch_wohnen', 'galerie_klassisch_wohnen' );