Отзывник пользовательский тип поста и использует шорткод

function md_testimonial_loop() {
    ob_start();
  
    $args = array(
      "post_type"         => "testimonials",
      "posts_per_page"    => -1,
    );
  
    $the_query = new WP_Query($args);
  
    if ( $the_query->have_posts() ) {
      echo '<div class="slider" id="testi_slider">';
      while ( $the_query->have_posts() ) {
          $the_query->the_post();
          echo '<div class="testi_content">' . the_content() . '</div>';
          echo '<div class="testi_author">' . get_the_title() . '</div>';
  
          $rating = get_field('star_rating');
          if ($rating) :
            echo '<div class="testi_rating"><img src="http://localhost/md/staging/salty-lives/wp-content/uploads/2022/05/STAR-'. $rating .'.png" alt="'.get_the_title().'-rating" /></div>';
          else :
            echo '<div class="testi_rating"><img src="http://localhost/md/staging/salty-lives/wp-content/uploads/2022/05/STAR-5.png" alt="'.get_the_title().'-rating"/></div>';
          endif;
      }
      echo '</div>';
    } else {
      echo '<p>No testimonials review added for the website.</p>';
    }
  
    wp_reset_postdata();
    $output = ob_get_clean();
      return $output;
  
  }
  add_shortcode('md_testimonials_shortcode', 'md_testimonial_loop');
Victorious Vole