- Rename plugin from Crawlsy Menus to CannaIQ Menus - Update version to 1.5.3 - Update text domain to cannaiq-menus - Rename all CSS classes from crawlsy-* to cannaiq-* - Update shortcodes to [cannaiq_products] and [cannaiq_product] - Add backward compatibility for legacy shortcodes - Update download links on Home and LandingPage - Fix health panel Redis timeout issue - Add clear error message when backend not running 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
80 lines
3.4 KiB
PHP
80 lines
3.4 KiB
PHP
<?php
|
|
/**
|
|
* Template for Product Grid (used by shortcode)
|
|
*/
|
|
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
$columns = isset($atts['columns']) ? $atts['columns'] : 3;
|
|
?>
|
|
|
|
<div class="cannaiq-product-grid cannaiq-grid-cols-<?php echo esc_attr($columns); ?>">
|
|
<?php foreach ($products as $product):
|
|
$image_url = $product['image_url'] ?? $product['primary_image_url'] ?? '';
|
|
$product_url = !empty($product['menu_url']) ? $product['menu_url'] : '#';
|
|
?>
|
|
<div class="cannaiq-product-card"
|
|
<?php if ($product_url !== '#'): ?>onclick="window.open('<?php echo esc_url($product_url); ?>', '_blank')"<?php endif; ?>
|
|
style="cursor: <?php echo ($product_url !== '#') ? 'pointer' : 'default'; ?>;">
|
|
<?php if (!empty($image_url)): ?>
|
|
<div class="cannaiq-product-image">
|
|
<img src="<?php echo esc_url($image_url); ?>"
|
|
alt="<?php echo esc_attr($product['name']); ?>"
|
|
loading="lazy" />
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="cannaiq-product-content">
|
|
<h3 class="cannaiq-product-title">
|
|
<?php echo esc_html($product['name']); ?>
|
|
</h3>
|
|
|
|
<?php if (!empty($product['brand'])): ?>
|
|
<div class="cannaiq-product-brand">
|
|
<?php echo esc_html($product['brand']); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($product['description'])): ?>
|
|
<p class="cannaiq-product-description">
|
|
<?php echo esc_html(wp_trim_words($product['description'], 15)); ?>
|
|
</p>
|
|
<?php endif; ?>
|
|
|
|
<div class="cannaiq-product-meta">
|
|
<?php if (!empty($product['thc_percentage'])): ?>
|
|
<span class="cannaiq-meta-item cannaiq-thc">
|
|
<strong>THC:</strong> <?php echo esc_html($product['thc_percentage']); ?>%
|
|
</span>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($product['cbd_percentage'])): ?>
|
|
<span class="cannaiq-meta-item cannaiq-cbd">
|
|
<strong>CBD:</strong> <?php echo esc_html($product['cbd_percentage']); ?>%
|
|
</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php if (isset($product['regular_price'])): ?>
|
|
<div class="cannaiq-product-price">
|
|
<?php if (!empty($product['sale_price']) && $product['sale_price'] != $product['regular_price']): ?>
|
|
<span class="cannaiq-price-sale">$<?php echo esc_html($product['sale_price']); ?></span>
|
|
<span class="cannaiq-price-regular cannaiq-strikethrough">$<?php echo esc_html($product['regular_price']); ?></span>
|
|
<?php else: ?>
|
|
$<?php echo esc_html($product['regular_price']); ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!$product['in_stock']): ?>
|
|
<div class="cannaiq-out-of-stock">
|
|
<?php _e('Out of Stock', 'cannaiq-menus'); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|