There is such a loop in WP:

<?php /*Start the loop*/ ?> <?php $specialistquery = new WP_Query('category_name=our-specialists'); ?> <?php while ( $specialistquery->have_posts()) : $specialistquery->the_post()?> <div class="full-info clear"> <?php the_post_thumbnail(); ?> <p class="name visible"><?php the_title() ?></p> <div class="post-content"> <?php get_template_part( 'template-parts/content' ); ?> <img class="close-full" src=""> </div> <p class="specialization visible"><?php echo get_post_meta($post->ID, 'specialization', true) ?></p> <p class="education visible"><?php echo get_post_meta($post->ID, 'education', true) ?></p> <p class="experience visible">Стаж более 25 лет</p> </div> <?php endwhile; ?> <script type="text/javascript"> $(document).ready(function(){ $('.specialist-content').on('click','.full-info',function(){ $(this).find('.post-content').css({'display':'inline','background':'#f1f5f5'}); $(this).find('.specialization').css({'display':'none'}); $(this).find('.education').css({'display':'none'}); $(this).find('.experience').css({'display':'none'}); $(this).find('.attachment-post-thumbnail').css({'margin':'0 30px 25px 0','width':'300px','height':'300px'}); }); }); </script> <script type="text/javascript"> $(document).ready(function(){ $('.specialist-content').on('click','.close-full',function(){ $(this).find('.post-content').css({'display':'none','background':'none'}); $(this).find('.specialization').css({'display':'inline'}); $(this).find('.education').css({'display':'inline'}); $(this).find('.experience').css({'display':'inline'}); $(this).find('.attachment-post-thumbnail').css({'margin':'0','width':'300px','height':'300px'}); }); }); </script> 
Slightly corrected the code, but now you need to close when you click on the image, but nothing comes out. click close-full

  • What does $('.<?php echo get_the_ID() ?>') in the console? - Ponio
  • No, the post ID displays in each iteration. Your ID is ok in this respect - Spiridon Robakidze
  • My eyes. Somebody code - mr . Black
  • one
    Replaced type=\"text/javascript\" with type="text/javascript" and earned. Removed extra slashes - Mr. Black
  • one
    @ Ivan I don’t quite understand, because of their lack of education, how will this work? - Spiridon Robakidze

0