feat(plugin): Add Elementor dynamic tags and product loop widget v1.7.0
WordPress Plugin: - Add dynamic tags for all product payload fields (name, brand, price, THC, effects, etc.) - Add Product Loop widget with filtering, sorting, and layout options - Register CannaIQ widget category in Elementor - Update build script to auto-upload to MinIO CDN - Remove legacy dutchie references - Bump version to 1.7.0 Backend: - Redirect /downloads/* to CDN instead of serving from local filesystem 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* 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.6.0
|
||||
* Version: 1.7.0
|
||||
* Author: CannaIQ
|
||||
* Author URI: https://cannaiq.co
|
||||
* License: GPL v2 or later
|
||||
@@ -15,7 +15,7 @@ if (!defined('ABSPATH')) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
define('CANNAIQ_MENUS_VERSION', '1.6.0');
|
||||
define('CANNAIQ_MENUS_VERSION', '1.7.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__));
|
||||
@@ -36,27 +36,42 @@ class CannaIQ_Menus_Plugin {
|
||||
|
||||
public function __construct() {
|
||||
add_action('plugins_loaded', [$this, 'init']);
|
||||
add_action('elementor/elements/categories_registered', [$this, 'register_elementor_category']);
|
||||
add_action('elementor/widgets/register', [$this, 'register_elementor_widgets']);
|
||||
add_action('admin_menu', [$this, 'add_admin_menu']);
|
||||
add_action('admin_init', [$this, 'register_settings']);
|
||||
add_action('wp_enqueue_scripts', [$this, 'enqueue_scripts']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register CannaIQ Elementor Widget Category
|
||||
*/
|
||||
public function register_elementor_category($elements_manager) {
|
||||
$elements_manager->add_category(
|
||||
'cannaiq',
|
||||
[
|
||||
'title' => __('CannaIQ', 'cannaiq-menus'),
|
||||
'icon' => 'fa fa-cannabis',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function init() {
|
||||
// Initialize plugin
|
||||
load_plugin_textdomain('cannaiq-menus', false, dirname(plugin_basename(__FILE__)) . '/languages');
|
||||
|
||||
// Load Elementor Dynamic Tags (if Elementor is active)
|
||||
if (did_action('elementor/loaded')) {
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/dynamic-tags.php';
|
||||
}
|
||||
|
||||
// Register shortcodes - primary CannaIQ shortcodes
|
||||
add_shortcode('cannaiq_products', [$this, 'products_shortcode']);
|
||||
add_shortcode('cannaiq_product', [$this, 'single_product_shortcode']);
|
||||
|
||||
// DEPRECATED: Legacy shortcode aliases for backward compatibility only
|
||||
// These allow sites that used the old plugin names to continue working
|
||||
// New implementations should use [cannaiq_products] and [cannaiq_product]
|
||||
add_shortcode('crawlsy_products', [$this, 'products_shortcode']); // deprecated
|
||||
add_shortcode('crawlsy_product', [$this, 'single_product_shortcode']); // deprecated
|
||||
add_shortcode('dutchie_products', [$this, 'products_shortcode']); // deprecated
|
||||
add_shortcode('dutchie_product', [$this, 'single_product_shortcode']); // deprecated
|
||||
// DEPRECATED: Legacy shortcode alias for backward compatibility only
|
||||
add_shortcode('crawlsy_products', [$this, 'products_shortcode']);
|
||||
add_shortcode('crawlsy_product', [$this, 'single_product_shortcode']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,12 +83,14 @@ class CannaIQ_Menus_Plugin {
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/brand-grid.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/category-list.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/specials-grid.php';
|
||||
require_once CANNAIQ_MENUS_PLUGIN_DIR . 'widgets/product-loop.php';
|
||||
|
||||
$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());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,18 +134,10 @@ class CannaIQ_Menus_Plugin {
|
||||
public function register_settings() {
|
||||
register_setting('cannaiq_menus_settings', 'cannaiq_api_token');
|
||||
|
||||
// MIGRATION: Auto-migrate API tokens from old plugin versions
|
||||
// This runs once - if user had crawlsy or dutchie plugin, their token is preserved
|
||||
// Can be removed in a future major version once all users have migrated
|
||||
// MIGRATION: Auto-migrate API token from old Crawlsy plugin
|
||||
$old_crawlsy_token = get_option('crawlsy_api_token');
|
||||
$old_dutchie_token = get_option('dutchie_api_token');
|
||||
|
||||
if (!get_option('cannaiq_api_token')) {
|
||||
if ($old_crawlsy_token) {
|
||||
update_option('cannaiq_api_token', $old_crawlsy_token);
|
||||
} elseif ($old_dutchie_token) {
|
||||
update_option('cannaiq_api_token', $old_dutchie_token);
|
||||
}
|
||||
if (!get_option('cannaiq_api_token') && $old_crawlsy_token) {
|
||||
update_option('cannaiq_api_token', $old_crawlsy_token);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user