| 1 |
<?php |
| 2 |
/** |
| 3 |
* Testimonial section – Layout 3 (compact) |
| 4 |
* |
| 5 |
* Single row: stars + short quote + em dash + author name. |
| 6 |
* Benefits checklist below in compact style. |
| 7 |
* |
| 8 |
* @package WPFunnels |
| 9 |
* @var array $args Full testimonial config array. |
| 10 |
*/ |
| 11 |
|
| 12 |
defined( 'ABSPATH' ) || exit; |
| 13 |
|
| 14 |
$testimonial = isset( $args['testimonial'] ) ? $args['testimonial'] : array(); |
| 15 |
$benefits = isset( $args['benefits'] ) ? $args['benefits'] : array(); |
| 16 |
|
| 17 |
$text = isset( $testimonial['text'] ) ? $testimonial['text'] : ''; |
| 18 |
$author = isset( $testimonial['author'] ) ? $testimonial['author'] : ''; |
| 19 |
$rating = isset( $testimonial['rating'] ) ? (int) $testimonial['rating'] : 5; |
| 20 |
$rating = max( 1, min( 5, $rating ) ); |
| 21 |
|
| 22 |
$ben_title = isset( $benefits['title'] ) ? $benefits['title'] : ''; |
| 23 |
$ben_items = isset( $benefits['items'] ) && is_array( $benefits['items'] ) ? $benefits['items'] : array(); |
| 24 |
?> |
| 25 |
<div class="wpfnl-reset wpfnl-testimonial wpfnl-testimonial--layout-3"> |
| 26 |
|
| 27 |
<!-- Compact inline row --> |
| 28 |
<div class="wpfnl-testimonial__compact-row"> |
| 29 |
<span class="wpfnl-testimonial__stars wpfnl-testimonial__stars--inline" aria-label="<?php echo esc_attr( sprintf( __( '%d out of 5 stars', 'wpfnl' ), $rating ) ); ?>"> |
| 30 |
<?php for ( $i = 1; $i <= 5; $i++ ) : ?> |
| 31 |
<span class="wpfnl-testimonial__star<?php echo $i <= $rating ? ' wpfnl-testimonial__star--filled' : ''; ?>" aria-hidden="true">★</span> |
| 32 |
<?php endfor; ?> |
| 33 |
</span> |
| 34 |
|
| 35 |
<?php if ( $text ) : ?> |
| 36 |
<span class="wpfnl-testimonial__text wpfnl-testimonial__text--inline"><?php echo wp_kses_post( $text ); ?></span> |
| 37 |
<?php endif; ?> |
| 38 |
|
| 39 |
<?php if ( $author ) : ?> |
| 40 |
<span class="wpfnl-testimonial__author wpfnl-testimonial__author--inline">— <?php echo esc_html( $author ); ?></span> |
| 41 |
<?php endif; ?> |
| 42 |
</div> |
| 43 |
<!-- /compact row --> |
| 44 |
|
| 45 |
<?php if ( $ben_title || $ben_items ) : ?> |
| 46 |
<!-- Benefits (compact) --> |
| 47 |
<div class="wpfnl-testimonial__benefits-card wpfnl-testimonial__benefits-card--compact"> |
| 48 |
<?php if ( $ben_title ) : ?> |
| 49 |
<h4 class="wpfnl-testimonial__benefits-title"><?php echo esc_html( $ben_title ); ?></h4> |
| 50 |
<?php endif; ?> |
| 51 |
|
| 52 |
<?php if ( $ben_items ) : ?> |
| 53 |
<ul class="wpfnl-testimonial__benefits-list wpfnl-testimonial__benefits-list--compact"> |
| 54 |
<?php foreach ( $ben_items as $item ) : ?> |
| 55 |
<?php if ( '' !== trim( $item ) ) : ?> |
| 56 |
<li class="wpfnl-testimonial__benefits-item"> |
| 57 |
<span class="wpfnl-testimonial__check-icon" aria-hidden="true"> |
| 58 |
<svg width="14" height="14" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="8" cy="8" r="8" fill="#22C55E"/><path d="M4.5 8.5l2.5 2.5 4.5-5" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg> |
| 59 |
</span> |
| 60 |
<span class="wpfnl-testimonial__benefits-item-text"><?php echo esc_html( $item ); ?></span> |
| 61 |
</li> |
| 62 |
<?php endif; ?> |
| 63 |
<?php endforeach; ?> |
| 64 |
</ul> |
| 65 |
<?php endif; ?> |
| 66 |
</div> |
| 67 |
<!-- /benefits --> |
| 68 |
<?php endif; ?> |
| 69 |
|
| 70 |
</div> |
| 71 |
|