How to bring 3 photos from the article instead of the thumbnail?

Under the article you want to bring 5 similar articles with the description. And they also output a thumbnail, and 3 photos of each article.
could you tell me what code this can be done?
April 19th 20 at 12:18
1 answer
April 19th 20 at 12:20
get_3_first_attach function( $post_ID ) {


 $items = get_posts( [
 'post_type' => 'attachment',
 'posts_per_page' => 3,
 'post_parent' => $post_ID
 ] );

 return !empty($items) ? $items : false;
}
sorry for the stupid question
as in the template display now?

List of trading so
<?php
 $categories = get_the_category($post->ID); 
 if ($categories) {
 echo '<div class="commenth4">more:</div>';
 $category_ids = array();
 foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
 $args=array('category__in' => $category_ids,'post__not_in' => array($post->ID),'showposts'=>8,'orderby'=>'rand','ignore_sticky_posts'=>1);
 $my_query = new wp_query($args);
 if( $my_query->have_posts() ) {
 while ($my_query->have_posts()) {
$my_query->the_post();
 ?> 
 <div class="post-sidebar. bottom">
 <?php the_post_thumbnail('medium'); ?> 
 <a class="title" itemprop="headline" href="<?php the_permalink() ?>"><?php the_title(); ?></a> 
 </div> 
<?php
}
}
wp_reset_query();
}
 ?>
- zaria.Heller30 commented on April 19th 20 at 12:23
@zaria.Heller30,
sorry for the stupid question
But why go there, where no ear or snout?

If not zero, but the exchange and to look for spices - bernita.Flatley61 commented on April 19th 20 at 12:26
@zaria.Heller30, first of all, there is nothing here to swear, the second the answer was given as to the data further, it is necessary to have a minimum knowledge in php, html, wp Core.

How to get 3 attachments from the post, the answer is Dan Dan is that hard.
Rest in the presence of minimal knowledge - brainer, but if not, then it is already and write me the code, and it is the job, and it must be paid. - bernita.Flatley61 commented on April 19th 20 at 12:29

Find more questions by tags WordPress