PluginProbe ʕ •ᴥ•ʔ
Author Website Templates – Create Writer, Author & Publisher Websites Easily / 1.1.5
Author Website Templates – Create Writer, Author & Publisher Websites Easily v1.1.5
trunk 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9
author-website-templates / build / blocks / author-pro / book-hero / render.php
author-website-templates / build / blocks / author-pro / book-hero Last commit date
block.json 4 months ago index.asset.php 4 months ago index.js 4 months ago render.php 4 months ago
render.php
409 lines
1 <?php
2 /**
3 * Render Book Hero [Author Pro] Block
4 */
5
6 $block_id = isset($attributes['blockId']) ? $attributes['blockId'] : '';
7 if (empty($block_id)) {
8 $block_id = 'awt-book-hero-' . uniqid();
9 }
10
11 // Data Handling to support Editor vs Frontend
12 $book_id = get_the_ID();
13 $is_editor = defined('REST_REQUEST') && REST_REQUEST === true;
14
15 // If in editor and not on a book post, try to find the latest book for preview
16 if ($is_editor && get_post_type($book_id) !== 'book') {
17 $min_query = new WP_Query([
18 'post_type' => 'book',
19 'posts_per_page' => 1,
20 'post_status' => 'publish'
21 ]);
22 if ($min_query->have_posts()) {
23 $min_query->the_post();
24 $book_id = get_the_ID();
25 wp_reset_postdata();
26 }
27 }
28
29 // 1. Fetch Data
30 // Basic
31 $title = get_the_title($book_id);
32 $permalink = get_permalink($book_id);
33 $cover_url = get_the_post_thumbnail_url($book_id, 'full');
34 $description = get_post_meta($book_id, '_rsbs_short_description', true);
35
36 if (empty($description)) {
37 // fallback to excerpt or content trimmed
38 $post_obj = get_post($book_id);
39 $description = $post_obj->post_excerpt ? $post_obj->post_excerpt : wp_trim_words($post_obj->post_content, 30);
40 }
41
42 // Stats
43 $pages = get_post_meta($book_id, '_rsbs_book_pages', true);
44 $year = get_post_meta($book_id, '_rsbs_book_publish_year', true);
45 $language = get_post_meta($book_id, '_rsbs_book_language', true);
46
47 // Pricing
48 $regular_price = get_post_meta($book_id, '_rsbs_book_price', true);
49 $sale_price = get_post_meta($book_id, '_rsbs_book_sale_price', true);
50
51 // Format Prices
52 $regular_price_clean = floatval(preg_replace('/[^0-9.]/', '', $regular_price));
53 $sale_price_clean = floatval(preg_replace('/[^0-9.]/', '', $sale_price));
54 $has_sale = $sale_price_clean > 0 && $sale_price_clean < $regular_price_clean;
55
56 $savings_pct = 0;
57 if ($has_sale && $regular_price_clean > 0) {
58 $savings_pct = round((($regular_price_clean - $sale_price_clean) / $regular_price_clean) * 100);
59 }
60
61 // Buttons
62 $buy_btn_text = get_post_meta($book_id, '_rsbs_buy_btn_text', true);
63 $buy_btn_link = get_post_meta($book_id, '_rsbs_buy_btn_link', true);
64 if (empty($buy_btn_text)) $buy_btn_text = 'Buy on Amazon';
65
66 // Secondary Buttons/Stores
67 $stores_list = get_post_meta($book_id, 'rswpbs_also_available_website_list', true);
68
69
70 // Formats
71 $formats_data = get_post_meta($book_id, 'rswpbs_book_formats', true);
72 $formats_string = '';
73 if (!empty($formats_data) && is_array($formats_data)) {
74 $format_names = [];
75 foreach ($formats_data as $cat) {
76 if (!empty($cat['name'])) {
77 $format_names[] = $cat['name'];
78 }
79 }
80 if (!empty($format_names)) {
81 $formats_string = implode(', ', $format_names);
82 }
83 }
84
85
86 // Reviews Calculation
87 $review_args = [
88 'post_type' => 'book_reviews',
89 'posts_per_page' => -1,
90 'meta_query' => [
91 [
92 'key' => '_rswpbs_reviewed_book',
93 'value' => $book_id,
94 'compare' => '='
95 ]
96 ]
97 ];
98 $reviews_query = new WP_Query($review_args);
99 $total_reviews = $reviews_query->found_posts;
100 $sum_rating = 0;
101
102 if ($reviews_query->have_posts()) {
103 while ($reviews_query->have_posts()) {
104 $reviews_query->the_post();
105 $r_val = get_post_meta(get_the_ID(), '_rswpbs_rating', true);
106 $sum_rating += floatval($r_val);
107 }
108 wp_reset_postdata();
109 }
110
111 $avg_rating = ($total_reviews > 0) ? round($sum_rating / $total_reviews, 1) : 0;
112
113
114 // 2. Attributes
115 $show_breadcrumbs = isset($attributes['showBreadcrumbs']) ? $attributes['showBreadcrumbs'] : true;
116 $show_stats = isset($attributes['showStats']) ? $attributes['showStats'] : true;
117 $show_badge = isset($attributes['showBadge']) ? $attributes['showBadge'] : true;
118 $show_review_count = isset($attributes['showReviewCount']) ? $attributes['showReviewCount'] : true;
119
120 $badge_text = !empty($attributes['badgeText']) ? $attributes['badgeText'] : '#1 New York Times Bestseller';
121 $sub_title = !empty($attributes['subTitle']) ? $attributes['subTitle'] : '';
122 if (empty($sub_title)) {
123 $sub_title = get_post_meta($book_id, '_rsbs_book_reading_age', true);
124 if($sub_title) $sub_title = "Reading Age: " . $sub_title;
125 }
126
127 $formats_title = !empty($attributes['formatsTitle']) ? $attributes['formatsTitle'] : 'Available Formats';
128
129 $pages_label = !empty($attributes['pagesLabel']) ? $attributes['pagesLabel'] : 'Pages';
130 $year_label = !empty($attributes['yearLabel']) ? $attributes['yearLabel'] : 'Year';
131 $language_label = !empty($attributes['languageLabel']) ? $attributes['languageLabel'] : 'Language';
132 $review_link_text = !empty($attributes['reviewLinkText']) ? $attributes['reviewLinkText'] : 'Read %s Reviews';
133
134 // Colors
135 $section_bg = isset($attributes['sectionBg']) ? $attributes['sectionBg'] : '';
136 $primary_color = isset($attributes['primaryColor']) ? $attributes['primaryColor'] : (isset($attributes['titleColor']) ? $attributes['titleColor'] : '');
137 $secondary_color = isset($attributes['secondaryColor']) ? $attributes['secondaryColor'] : (isset($attributes['textColor']) ? $attributes['textColor'] : '');
138 $accent_color = isset($attributes['accentColor']) ? $attributes['accentColor'] : '';
139
140 $btn_bg = isset($attributes['btnBg']) ? $attributes['btnBg'] : ($accent_color ? $accent_color : '');
141 $btn_text = isset($attributes['btnText']) ? $attributes['btnText'] : '#ffffff';
142 $btn_hover_bg = isset($attributes['btnHoverBg']) ? $attributes['btnHoverBg'] : '';
143 $btn_hover_text = isset($attributes['btnHoverText']) ? $attributes['btnHoverText'] : '';
144
145
146 // 3. Dynamic CSS
147 $anchor = isset($attributes['anchor']) ? $attributes['anchor'] : '';
148 $element_id = !empty($anchor) ? $anchor : $block_id;
149 $css_id = '#' . $element_id;
150 $custom_css = "";
151
152 if ($section_bg) $custom_css .= "$css_id .awt-section-bg { background-color: $section_bg !important; }";
153 if ($primary_color) {
154 $custom_css .= "$css_id .text-primary { color: $primary_color !important; }";
155 $custom_css .= "$css_id .border-primary { border-color: $primary_color !important; }";
156 $custom_css .= "$css_id .bg-primary { background-color: $primary_color !important; }";
157 $custom_css .= "$css_id .hover\:text-primary:hover { color: $primary_color !important; }";
158 }
159 if ($secondary_color) {
160 $custom_css .= "$css_id .text-secondary { color: $secondary_color !important; }";
161 $custom_css .= "$css_id .prose-slate { color: $secondary_color !important; }";
162 }
163 if ($accent_color) {
164 $custom_css .= "$css_id .text-accent { color: $accent_color !important; }";
165 $custom_css .= "$css_id .bg-accent { background-color: $accent_color !important; }";
166 $custom_css .= "$css_id .border-accent { border-color: $accent_color !important; }";
167 $custom_css .= "$css_id .hover\:text-accent:hover { color: $accent_color !important; }";
168 $custom_css .= "$css_id .hover\:bg-accent:hover { background-color: $accent_color !important; }";
169 $custom_css .= "$css_id .hover\:border-accent:hover { border-color: $accent_color !important; }";
170
171 // SVG Fills
172 $custom_css .= "$css_id .awt-svg-accent { color: $accent_color !important; }";
173 $custom_css .= "$css_id .awt-blur-accent { background-color: " . rswpthemes_awt_hex2rgba($accent_color, 0.05) . " !important; }";
174 }
175
176 // Button Overrides
177 if ($btn_bg) $custom_css .= "$css_id .awt-btn-primary { background-color: $btn_bg !important; }";
178 if ($btn_text) $custom_css .= "$css_id .awt-btn-primary { color: $btn_text !important; }";
179 if ($btn_hover_bg) $custom_css .= "$css_id .awt-btn-primary:hover { background-color: $btn_hover_bg !important; }";
180 if ($btn_hover_text) $custom_css .= "$css_id .awt-btn-primary:hover { color: $btn_hover_text !important; }";
181
182
183 // Wrapper Attributes
184 $wrapper_attributes = get_block_wrapper_attributes([
185 'class' => 'awt-book-hero',
186 'id' => $element_id,
187 ]);
188
189 // Helper
190 if (!function_exists('rswpthemes_awt_hex2rgba')) {
191 function rswpthemes_awt_hex2rgba($color, $opacity = false) {
192 $default = 'rgb(0,0,0)';
193 if(empty($color)) return $default;
194 if ($color[0] == '#' ) {
195 $color = substr( $color, 1 );
196 }
197 if (strlen($color) == 6) {
198 $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
199 } elseif ( strlen( $color ) == 3 ) {
200 $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
201 } else {
202 return $default;
203 }
204 $rgb = array_map('hexdec', $hex);
205 if($opacity){
206 if(abs($opacity) > 1) $opacity = 1.0;
207 $output = 'rgba('.implode(",",$rgb).','.$opacity.')';
208 } else {
209 $output = 'rgb('.implode(",",$rgb).')';
210 }
211 return $output;
212 }
213 }
214 ?>
215
216 <?php if (!empty($custom_css)) : ?>
217 <style><?php echo $custom_css; ?></style>
218 <?php endif; ?>
219
220 <div <?php echo $wrapper_attributes; ?>>
221 <?php if ($show_breadcrumbs) : ?>
222 <div class="pt-4 pb-4 bg-paper border-b border-gray-100 awt-breadcrumb-section">
223 <div class="awt-container">
224 <nav class="flex text-xs font-medium text-gray-400" aria-label="Breadcrumb">
225 <ol class="flex list-none items-center space-x-2">
226 <li><a href="<?php echo home_url(); ?>" class="hover:text-primary text-gray-400 transition">Home</a></li>
227 <li>
228 <!-- Chevron Right -->
229 <svg class="w-2.5 h-2.5" fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path d="M471.1 297.4C483.6 309.9 483.6 330.2 471.1 342.7L279.1 534.7C266.6 547.2 246.3 547.2 233.8 534.7C221.3 522.2 221.3 501.9 233.8 489.4L403.2 320L233.9 150.6C221.4 138.1 221.4 117.8 233.9 105.3C246.4 92.8 266.7 92.8 279.2 105.3L471.2 297.3z"/></svg>
230 </li>
231 <li><a href="<?php echo get_post_type_archive_link('book'); ?>" class="hover:text-primary text-gray-400 transition">Books</a></li>
232 <li>
233 <!-- Chevron Right -->
234 <svg class="w-2.5 h-2.5" fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path d="M471.1 297.4C483.6 309.9 483.6 330.2 471.1 342.7L279.1 534.7C266.6 547.2 246.3 547.2 233.8 534.7C221.3 522.2 221.3 501.9 233.8 489.4L403.2 320L233.9 150.6C221.4 138.1 221.4 117.8 233.9 105.3C246.4 92.8 266.7 92.8 279.2 105.3L471.2 297.3z"/></svg>
235 </li>
236 <li class="text-accent font-bold"><?php echo esc_html($title); ?></li>
237 </ol>
238 </nav>
239 </div>
240 </div>
241 <?php endif; ?>
242
243 <section class="py-12 lg:py-20 bg-white awt-section-bg">
244 <div class="awt-container">
245 <div class="grid grid-cols-1 lg:grid-cols-12 gap-12 lg:gap-20">
246
247 <div class="lg:col-span-5 flex flex-col items-center">
248 <div class="relative w-full max-w-md mx-auto group">
249 <div
250 class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[120%] h-[120%] bg-accent/5 rounded-full blur-3xl -z-10 awt-blur-accent"
251 <?php if ($cover_url) echo 'style="background-image: url(' . esc_url($cover_url) . '); background-size: cover; opacity: 0.15;"'; ?>
252 >
253 </div>
254
255 <div
256 class="relative rounded-lg shadow-2xl overflow-hidden transform transition duration-500 hover:scale-[1.02]">
257 <?php if ($cover_url) : ?>
258 <img src="<?php echo esc_url($cover_url); ?>"
259 alt="<?php echo esc_attr($title); ?>" class="w-full h-auto object-cover">
260 <?php else : ?>
261 <div class="w-full h-96 bg-gray-200 flex items-center justify-center text-gray-400">No Image</div>
262 <?php endif; ?>
263
264 <a href="#"
265 class="absolute bottom-6 right-6 w-12 h-12 bg-white rounded-full shadow-lg flex items-center justify-center text-accent hover:bg-accent hover:text-white transition group-hover:scale-110 awt-svg-accent">
266 <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16"> <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/> <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5z"/> </svg>
267 </a>
268 </div>
269 </div>
270
271 <?php if ($show_stats) : ?>
272 <div class="grid grid-cols-3 gap-4 w-full max-w-md mt-8 border-t border-b border-gray-100 py-6">
273 <div class="text-center border-r border-gray-100">
274 <span class="block text-xl font-bold text-primary font-serif"><?php echo esc_html($pages); ?></span>
275 <span class="text-xs text-gray-400 uppercase tracking-wider"><?php echo esc_html($pages_label); ?></span>
276 </div>
277 <div class="text-center border-r border-gray-100">
278 <span class="block text-xl font-bold text-primary font-serif"><?php echo esc_html($year); ?></span>
279 <span class="text-xs text-gray-400 uppercase tracking-wider"><?php echo esc_html($year_label); ?></span>
280 </div>
281 <div class="text-center">
282 <span class="block text-xl font-bold text-primary font-serif"><?php echo esc_html($language); ?></span>
283 <span class="text-xs text-gray-400 uppercase tracking-wider"><?php echo esc_html($language_label); ?></span>
284 </div>
285 </div>
286 <?php endif; ?>
287 </div>
288
289 <div class="lg:col-span-7 flex flex-col justify-center">
290 <div class="mb-6">
291 <?php if ($show_badge && !empty($badge_text)) : ?>
292 <div
293 class="inline-flex items-center gap-2 px-3 py-1 bg-yellow-50 text-yellow-700 rounded-full text-xs font-bold uppercase tracking-wider mb-4 awt-badge-container">
294 <!-- Trophy Icon -->
295 <svg class="w-3 h-3 mr-1" fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path d="M208.3 64L432.3 64C458.8 64 480.4 85.8 479.4 112.2C479.2 117.5 479 122.8 478.7 128L528.3 128C554.4 128 577.4 149.6 575.4 177.8C567.9 281.5 514.9 338.5 457.4 368.3C441.6 376.5 425.5 382.6 410.2 387.1C390 415.7 369 430.8 352.3 438.9L352.3 512L416.3 512C434 512 448.3 526.3 448.3 544C448.3 561.7 434 576 416.3 576L224.3 576C206.6 576 192.3 561.7 192.3 544C192.3 526.3 206.6 512 224.3 512L288.3 512L288.3 438.9C272.3 431.2 252.4 416.9 233 390.6C214.6 385.8 194.6 378.5 175.1 367.5C121 337.2 72.2 280.1 65.2 177.6C63.3 149.5 86.2 127.9 112.3 127.9L161.9 127.9C161.6 122.7 161.4 117.5 161.2 112.1C160.2 85.6 181.8 63.9 208.3 63.9zM165.5 176L113.1 176C119.3 260.7 158.2 303.1 198.3 325.6C183.9 288.3 172 239.6 165.5 176zM444 320.8C484.5 297 521.1 254.7 527.3 176L475 176C468.8 236.9 457.6 284.2 444 320.8z"/></svg>
296 <?php echo esc_html($badge_text); ?>
297 </div>
298 <?php endif; ?>
299 <h1 class="text-4xl lg:text-5xl font-serif font-bold text-primary mb-2"><?php echo esc_html($title); ?></h1>
300 <?php if ($sub_title) : ?>
301 <p class="text-lg text-secondary font-medium"><?php echo esc_html($sub_title); ?></p>
302 <?php endif; ?>
303 </div>
304
305 <?php if ($show_review_count) : ?>
306 <div class="flex items-center gap-4 mb-8">
307 <div class="flex text-yellow-500 text-sm stars awt-svg-accent">
308 <?php
309 $stars = ($avg_rating > 0) ? round($avg_rating) : 0;
310 for($i=0; $i<5; $i++) {
311 if ($i < $stars) {
312 echo '<svg class="w-3 h-3" fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path d="M341.5 45.1C337.4 37.1 329.1 32 320.1 32C311.1 32 302.8 37.1 298.7 45.1L225.1 189.3L65.2 214.7C56.3 216.1 48.9 222.4 46.1 231C43.3 239.6 45.6 249 51.9 255.4L166.3 369.9L141.1 529.8C139.7 538.7 143.4 547.7 150.7 553C158 558.3 167.6 559.1 175.7 555L320.1 481.6L464.4 555C472.4 559.1 482.1 558.3 489.4 553C496.7 547.7 500.4 538.8 499 529.8L473.7 369.9L588.1 255.4C594.5 249 596.7 239.6 593.9 231C591.1 222.4 583.8 216.1 574.8 214.7L415 189.3L341.5 45.1z"/></svg>';
313 } else {
314 echo '<svg class="w-3 h-3 text-gray-300" fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path d="M341.5 45.1C337.4 37.1 329.1 32 320.1 32C311.1 32 302.8 37.1 298.7 45.1L225.1 189.3L65.2 214.7C56.3 216.1 48.9 222.4 46.1 231C43.3 239.6 45.6 249 51.9 255.4L166.3 369.9L141.1 529.8C139.7 538.7 143.4 547.7 150.7 553C158 558.3 167.6 559.1 175.7 555L320.1 481.6L464.4 555C472.4 559.1 482.1 558.3 489.4 553C496.7 547.7 500.4 538.8 499 529.8L473.7 369.9L588.1 255.4C594.5 249 596.7 239.6 593.9 231C591.1 222.4 583.8 216.1 574.8 214.7L415 189.3L341.5 45.1z"/></svg>';
315 }
316 }
317 ?>
318 </div>
319 <a href="#reviews"
320 class="text-sm text-gray-500 font-medium hover:text-accent cursor-pointer underline decoration-dotted transition">
321 <?php printf(esc_html($review_link_text), number_format($total_reviews)); ?>
322 </a>
323 </div>
324 <?php endif; ?>
325
326 <div class="prose prose-slate text-secondary mb-8 leading-relaxed">
327 <?php echo wp_kses_post($description); ?>
328 </div>
329
330 <div class="bg-paper p-6 rounded-xl border border-gray-100 mb-8 awt-pricing-box">
331 <div class="flex flex-wrap items-end gap-3 mb-6">
332 <?php if ($has_sale) : ?>
333 <span class="text-3xl font-serif font-bold text-accent"><?php echo '$' . esc_html($sale_price_clean); ?></span>
334 <span class="text-lg text-gray-400 line-through decoration-red-500 decoration-2 mb-1"><?php echo '$' . esc_html($regular_price_clean); ?></span>
335 <span class="text-xs font-bold text-green-600 bg-green-100 px-2 py-1 rounded ml-2 mb-1">Save <?php echo $savings_pct; ?>%</span>
336 <?php else: ?>
337 <span class="text-3xl font-serif font-bold text-accent"><?php echo '$' . esc_html($regular_price_clean); ?></span>
338 <?php endif; ?>
339 </div>
340
341 <div class="flex flex-wrap flex-col sm:flex-row gap-4 mb-4">
342 <?php if ($buy_btn_link) : ?>
343 <a href="<?php echo esc_url($buy_btn_link); ?>"
344 class="w-full sm:w-auto bg-accent awt-btn-primary text-white font-bold py-3.5 px-6 rounded text-center hover:bg-orange-700 transition shadow-lg shadow-orange-100 flex items-center justify-center gap-2">
345 <?php echo esc_html($buy_btn_text); ?>
346 </a>
347 <?php endif; ?>
348
349 <?php
350 if (!empty($stores_list) && is_array($stores_list)) {
351 foreach ($stores_list as $store) {
352 $store_name = isset($store['website_name']) ? $store['website_name'] : 'Store';
353 $store_url = isset($store['book_url']) ? $store['book_url'] : '#';
354
355 echo '<a href="'.esc_url($store_url).'" class="w-full sm:w-auto bg-white border border-gray-300 text-primary font-bold py-3.5 px-6 rounded text-center hover:border-accent hover:text-accent transition flex items-center justify-center gap-2">';
356 echo esc_html($store_name);
357 echo '</a>';
358 }
359 }
360 ?>
361 </div>
362
363 <?php if ($formats_string) : ?>
364 <p class="text-xs text-center text-gray-400 flex items-center justify-center">
365 <svg class="w-3 h-3 mr-2 text-green-500" fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path d="M530.8 134.1C545.1 144.5 548.3 164.5 537.9 178.8L281.9 530.8C276.4 538.4 267.9 543.1 258.5 543.9C249.1 544.7 240 541.2 233.4 534.6L105.4 406.6C92.9 394.1 92.9 373.8 105.4 361.3C117.9 348.8 138.2 348.8 150.7 361.3L252.2 462.8L486.2 141.1C496.6 126.8 516.6 123.6 530.9 134z"/></svg>
366 Available in <?php echo esc_html($formats_string); ?>
367 </p>
368 <?php endif; ?>
369 </div>
370
371 <div>
372 <h3 class="text-sm font-bold text-primary uppercase tracking-widest mb-4"><?php echo esc_html($formats_title); ?></h3>
373
374 <?php if (!empty($formats_data) && is_array($formats_data)) : ?>
375 <ul class="border border-gray-100 rounded-xl list-none pl-0 bg-paper overflow-hidden">
376 <?php foreach ($formats_data as $format) :
377 $f_name = !empty($format['name']) ? $format['name'] : '';
378 $f_price = !empty($format['price']) ? $format['price'] : '';
379 $f_link = !empty($format['link']) ? $format['link'] : '';
380 ?>
381 <li class="group border-b border-gray-100 last:border-0 transition hover:bg-white">
382 <a href="<?php echo esc_url($f_link ? $f_link : '#'); ?>" class="flex items-center justify-between p-4 no-underline <?php echo empty($f_link) ? 'pointer-events-none' : ''; ?>">
383 <div class="flex items-center gap-3">
384 <svg class="w-4 h-4 awt-svg-accent text-accent" fill="currentColor" viewBox="0 0 512 512">
385 <path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/>
386 </svg>
387 <span class="text-sm font-bold text-primary"><?php echo esc_html($f_name); ?></span>
388 </div>
389 <div class="flex items-center gap-2">
390 <span class="text-sm font-bold text-accent"><?php echo esc_html($f_price); ?></span>
391 <?php if ($f_link) : ?>
392 <svg class="w-3 h-3 text-gray-400 group-hover:text-accent transition" fill="currentColor" viewBox="0 0 320 512">
393 <path d="M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"/>
394 </svg>
395 <?php endif; ?>
396 </div>
397 </a>
398 </li>
399 <?php endforeach; ?>
400 </ul>
401 <?php endif; ?>
402 </div>
403
404 </div>
405 </div>
406 </div>
407 </section>
408 </div>
409