feat: CannaiQ Menus WordPress Plugin v2.0.0 - Modular Component Library
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
New modular component widgets: - Discount Ribbon (ribbon/pill/text styles) - Strain Badge (Sativa/Indica/Hybrid colored pills) - THC/CBD Meter (progress bars or badges) - Effects Display (styled chips with icons) - Price Block (original + sale price) - Cart Button (styled CTA linking to menu) - Stock Indicator (in/out of stock badges) - Product Image + Badges (image with overlays) New card template: - Premium Product Card (ready-to-use template) Extended dynamic tags (30+ total): - Discount %, Strain Badge, THC/CBD Badge - Effects Chips, Terpenes, Price Display - Menu URL, Stock Status, and more New files: - assets/css/components.css - includes/effects-icons.php (SVG icons) - 10 new widget files - dynamic-tags-extended.php Branding updated to "CannaiQ" throughout. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: CannaIQ Menus
|
||||
* Plugin Name: CannaiQ Menus
|
||||
* Plugin URI: https://cannaiq.co
|
||||
* Description: Display cannabis product menus from CannaIQ with Elementor integration. Real-time menu data updated daily.
|
||||
* Version: 1.7.0
|
||||
* Author: CannaIQ
|
||||
* Description: Display cannabis product menus from CannaiQ with Elementor integration. Real-time menu data updated daily.
|
||||
* Version: 2.0.0
|
||||
* Author: CannaiQ
|
||||
* Author URI: https://cannaiq.co
|
||||
* License: GPL v2 or later
|
||||
* Text Domain: cannaiq-menus
|
||||
@@ -15,7 +15,7 @@ if (!defined('ABSPATH')) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
define('CANNAIQ_MENUS_VERSION', '1.7.0');
|
||||
define('CANNAIQ_MENUS_VERSION', '2.0.0');
|
||||
define('CANNAIQ_MENUS_API_URL', 'https://cannaiq.co/api/v1');
|
||||
define('CANNAIQ_MENUS_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
||||
define('CANNAIQ_MENUS_PLUGIN_URL', plugin_dir_url(__FILE__));
|
||||
@@ -50,7 +50,7 @@ class CannaIQ_Menus_Plugin {
|
||||
$elements_manager->add_category(
|
||||
'cannaiq',
|
||||
[
|
||||
'title' => __('CannaIQ', 'cannaiq-menus'),
|
||||
'title' => __('CannaiQ', 'cannaiq-menus'),
|
||||
'icon' => 'fa fa-cannabis',
|
||||
]
|
||||
);
|
||||
@@ -60,9 +60,13 @@ class CannaIQ_Menus_Plugin {
|
||||
// Initialize plugin
|
||||
load_plugin_textdomain('cannaiq-menus', false, dirname(plugin_basename(__FILE__)) . '/languages');
|
||||
|
||||
// Load helper functions
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'includes/effects-icons.php';
|
||||
|
||||
// Load Elementor Dynamic Tags (if Elementor is active)
|
||||
if (did_action('elementor/loaded')) {
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/dynamic-tags.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/dynamic-tags-extended.php';
|
||||
}
|
||||
|
||||
// Register shortcodes - primary CannaIQ shortcodes
|
||||
@@ -78,6 +82,7 @@ class CannaIQ_Menus_Plugin {
|
||||
* Register Elementor Widgets
|
||||
*/
|
||||
public function register_elementor_widgets($widgets_manager) {
|
||||
// Legacy widgets
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/product-grid.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/single-product.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/brand-grid.php';
|
||||
@@ -85,18 +90,46 @@ class CannaIQ_Menus_Plugin {
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/specials-grid.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/product-loop.php';
|
||||
|
||||
// Modular component widgets (v2.0)
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/discount-ribbon.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/strain-badge.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/thc-meter.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/effects-display.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/price-block.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/cart-button.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/stock-indicator.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/product-image-overlay.php';
|
||||
|
||||
// Card templates (v2.0)
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/card-template-premium.php';
|
||||
|
||||
// Register legacy widgets
|
||||
$widgets_manager->register(new \CannaIQ_Menus_Product_Grid_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Menus_Single_Product_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Menus_Brand_Grid_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Menus_Category_List_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Menus_Specials_Grid_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Product_Loop_Widget());
|
||||
|
||||
// Register modular component widgets (v2.0)
|
||||
$widgets_manager->register(new \CannaIQ_Discount_Ribbon_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Strain_Badge_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_THC_Meter_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Effects_Display_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Price_Block_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Cart_Button_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Stock_Indicator_Widget());
|
||||
$widgets_manager->register(new \CannaIQ_Product_Image_Overlay_Widget());
|
||||
|
||||
// Register card templates (v2.0)
|
||||
$widgets_manager->register(new \CannaIQ_Premium_Card_Widget());
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue Scripts and Styles
|
||||
*/
|
||||
public function enqueue_scripts() {
|
||||
// Base styles
|
||||
wp_enqueue_style(
|
||||
'cannaiq-menus-styles',
|
||||
CANNAIQ_MENUS_PLUGIN_URL . 'assets/css/cannaiq-menus.css',
|
||||
@@ -104,6 +137,14 @@ class CannaIQ_Menus_Plugin {
|
||||
CANNAIQ_MENUS_VERSION
|
||||
);
|
||||
|
||||
// Component styles (v2.0 modular components)
|
||||
wp_enqueue_style(
|
||||
'cannaiq-components-styles',
|
||||
CANNAIQ_MENUS_PLUGIN_URL . 'assets/css/components.css',
|
||||
['cannaiq-menus-styles'],
|
||||
CANNAIQ_MENUS_VERSION
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
'cannaiq-menus-script',
|
||||
CANNAIQ_MENUS_PLUGIN_URL . 'assets/js/cannaiq-menus.js',
|
||||
@@ -118,8 +159,8 @@ class CannaIQ_Menus_Plugin {
|
||||
*/
|
||||
public function add_admin_menu() {
|
||||
add_menu_page(
|
||||
'CannaIQ Menus',
|
||||
'CannaIQ Menus',
|
||||
'CannaiQ Menus',
|
||||
'CannaiQ Menus',
|
||||
'manage_options',
|
||||
'cannaiq-menus',
|
||||
[$this, 'admin_page'],
|
||||
@@ -147,9 +188,9 @@ class CannaIQ_Menus_Plugin {
|
||||
public function admin_page() {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1>CannaIQ Menus Settings</h1>
|
||||
<p>Version <?php echo CANNAIQ_MENUS_VERSION; ?> by <a href="https://cannaiq.co" target="_blank">CannaIQ</a></p>
|
||||
<p class="description">Display real-time cannabis menus with data updated daily from CannaIQ.</p>
|
||||
<h1>CannaiQ Menus Settings</h1>
|
||||
<p>Version <?php echo CANNAIQ_MENUS_VERSION; ?> by <a href="https://cannaiq.co" target="_blank">CannaiQ</a></p>
|
||||
<p class="description">Display real-time cannabis menus with data updated daily from CannaiQ.</p>
|
||||
|
||||
<form method="post" action="options.php">
|
||||
<?php settings_fields('cannaiq_menus_settings'); ?>
|
||||
@@ -162,7 +203,7 @@ class CannaIQ_Menus_Plugin {
|
||||
<input type="password" id="cannaiq_api_token" name="cannaiq_api_token"
|
||||
value="<?php echo esc_attr(get_option('cannaiq_api_token')); ?>"
|
||||
class="regular-text" />
|
||||
<p class="description">Your authentication token from the CannaIQ admin dashboard. The token includes your store configuration.</p>
|
||||
<p class="description">Your authentication token from the CannaiQ admin dashboard. The token includes your store configuration.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -300,10 +341,10 @@ class CannaIQ_Menus_Plugin {
|
||||
</table>
|
||||
|
||||
<h3>Elementor Widgets</h3>
|
||||
<p>If you have Elementor installed, you can use the CannaIQ widgets:</p>
|
||||
<p>If you have Elementor installed, you can use the CannaiQ widgets:</p>
|
||||
<ul style="list-style: disc; margin-left: 20px;">
|
||||
<li><strong>CannaIQ Product Grid</strong> - Display a grid of products with filtering options</li>
|
||||
<li><strong>CannaIQ Single Product</strong> - Display a single product card</li>
|
||||
<li><strong>CannaiQ Product Grid</strong> - Display a grid of products with filtering options</li>
|
||||
<li><strong>CannaiQ Single Product</strong> - Display a single product card</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user