vamtam-testimonials.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. $content = get_the_content();
  3. $cite = get_post_meta( get_the_ID(), 'testimonial-author', true );
  4. $link = get_post_meta( get_the_ID(), 'testimonial-link', true );
  5. $rating = (int) get_post_meta( get_the_ID(), 'testimonial-rating', true );
  6. $summary = get_post_meta( get_the_ID(), 'testimonial-summary', true );
  7. $title = get_the_title();
  8. $rating_str = '';
  9. if ( ! empty( $link ) && ! empty( $cite ) ) {
  10. $cite = '<a href="' . esc_url( $link ) . '" target="_blank">' . $cite . '</a>';
  11. }
  12. if ( ! empty( $title ) ) {
  13. if ( vamtam_sanitize_bool( $settings->show_rating ) && $rating > 0 ) {
  14. $rating_str = str_repeat(
  15. vamtam_get_icon_html( array(
  16. 'name' => 'star3',
  17. ) ),
  18. $rating
  19. );
  20. $rating_str .= ' &mdash; ';
  21. }
  22. if ( ! empty( $cite ) ) {
  23. $cite = " <span class='company-name'>( $cite )</span>";
  24. }
  25. $title = "<div class='quote-title'>$rating_str<span class='the-title'>$title</span>$cite</div>";
  26. } elseif ( ! empty( $cite ) ) {
  27. $title = "<div class='quote-title'>$cite</div>";
  28. }
  29. ?>
  30. <blockquote <?php post_class( 'clearfix small simple alignment-' . $settings->alignment ) ?>>
  31. <?php if ( has_post_thumbnail() ) : ?>
  32. <div class="quote-thumbnail">
  33. <?php the_post_thumbnail( 'thumbnail' ); ?>
  34. </div>
  35. <?php endif ?>
  36. <div class='quote-text'>
  37. <?php if ( ! empty( $summary ) ) : ?>
  38. <h3 class="quote-summary"><?php echo wp_kses_post( $summary ) ?></h3>
  39. <?php endif ?>
  40. <div class="quote-title-wrapper clearfix">
  41. <?php echo wp_kses_post( $title ) ?>
  42. </div>
  43. <div class="quote-content">
  44. <?php echo wpautop( do_shortcode( $content ) ) // xss ok ?>
  45. </div>
  46. </div>
  47. </blockquote>