import
5 days ago
includes
5 days ago
metabox
5 days ago
notices
5 days ago
templates
5 days ago
mega-menu.php
5 days ago
plugin-options.php
5 days ago
popups.php
5 days ago
premade-blocks.php
5 days ago
templates-kit.php
5 days ago
theme-builder.php
5 days ago
mega-menu.php
462 lines
| 1 | <?php |
| 2 | use WprAddons\Plugin; |
| 3 | |
| 4 | // Register Post Type |
| 5 | function register_mega_menu_cpt() { |
| 6 | $args = array( |
| 7 | 'label' => esc_html__( 'Royal Mega Menu', 'wpr-addons' ), |
| 8 | 'public' => true, |
| 9 | 'publicly_queryable' => true, |
| 10 | 'rewrite' => false, |
| 11 | 'show_ui' => true, |
| 12 | 'show_in_menu' => false, |
| 13 | 'show_in_nav_menus' => false, |
| 14 | 'exclude_from_search' => true, |
| 15 | 'capability_type' => 'post', |
| 16 | 'supports' => array( 'title', 'editor', 'elementor' ), |
| 17 | 'hierarchical' => false, |
| 18 | ); |
| 19 | |
| 20 | register_post_type( 'wpr_mega_menu', $args ); |
| 21 | } |
| 22 | |
| 23 | // Convert to Canvas Template |
| 24 | function convert_to_canvas_template( $template ) { |
| 25 | if ( is_singular('wpr_mega_menu') ) { |
| 26 | $template = WPR_ADDONS_PATH . 'admin/templates/wpr-canvas.php'; |
| 27 | } |
| 28 | |
| 29 | return $template; |
| 30 | } |
| 31 | |
| 32 | // Init Mega Menu |
| 33 | function init_mega_menu() { |
| 34 | register_mega_menu_cpt(); |
| 35 | add_action( 'template_include', 'convert_to_canvas_template', 9999 ); |
| 36 | } |
| 37 | |
| 38 | add_action('init', 'init_mega_menu', 999); |
| 39 | |
| 40 | |
| 41 | // Confinue only for Dashboard Screen |
| 42 | if ( !is_admin() ) return; |
| 43 | |
| 44 | // Init Actions |
| 45 | add_filter( 'option_elementor_cpt_support', 'add_mega_menu_cpt_support' ); |
| 46 | add_filter( 'default_option_elementor_cpt_support', 'add_mega_menu_cpt_support' ); |
| 47 | add_action( 'admin_footer', 'render_settings_popup', 10 ); |
| 48 | add_action( 'wp_ajax_wpr_create_mega_menu_template', 'wpr_create_mega_menu_template' ); |
| 49 | add_action( 'wp_ajax_wpr_save_mega_menu_settings', 'wpr_save_mega_menu_settings' ); |
| 50 | add_action( 'admin_enqueue_scripts', 'enqueue_scripts' ); |
| 51 | |
| 52 | // Add Elementor Editor Support |
| 53 | function add_mega_menu_cpt_support( $value ) { |
| 54 | if ( empty( $value ) ) { |
| 55 | $value = []; |
| 56 | } |
| 57 | |
| 58 | return array_merge( $value, ['wpr_mega_menu'] ); |
| 59 | } |
| 60 | |
| 61 | // Create Menu Template |
| 62 | function wpr_create_mega_menu_template() { |
| 63 | |
| 64 | if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'wpr-mega-menu-js' ) || ! current_user_can( 'manage_options' ) ) { |
| 65 | wp_send_json_error( [ 'message' => 'Invalid request.' ] ); |
| 66 | return; |
| 67 | } |
| 68 | |
| 69 | if ( ! isset( $_POST['item_id'] ) ) { |
| 70 | wp_send_json_error( [ 'message' => 'Missing item_id.' ] ); |
| 71 | return; |
| 72 | } |
| 73 | |
| 74 | $menu_item_id = absint( $_POST['item_id'] ); |
| 75 | $menu_item = get_post( $menu_item_id ); |
| 76 | if ( ! $menu_item || $menu_item->post_type !== 'nav_menu_item' ) { |
| 77 | wp_send_json_error( [ 'message' => 'Invalid menu item.' ] ); |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | $mega_menu_id = get_post_meta( $menu_item_id, 'wpr-mega-menu-item', true ); |
| 82 | |
| 83 | if ( ! $mega_menu_id ) { |
| 84 | |
| 85 | $mega_menu_id = wp_insert_post( array( |
| 86 | 'post_title' => 'wpr-mega-menu-item-' . $menu_item_id, |
| 87 | 'post_status' => 'publish', |
| 88 | 'post_type' => 'wpr_mega_menu', |
| 89 | ) ); |
| 90 | |
| 91 | update_post_meta( $menu_item_id, 'wpr-mega-menu-item', $mega_menu_id ); |
| 92 | |
| 93 | } |
| 94 | |
| 95 | $edit_link = add_query_arg( |
| 96 | array( |
| 97 | 'post' => $mega_menu_id, |
| 98 | 'action' => 'elementor', |
| 99 | ), |
| 100 | admin_url( 'post.php' ) |
| 101 | ); |
| 102 | |
| 103 | wp_send_json([ |
| 104 | 'data' => [ |
| 105 | 'edit_link' => $edit_link |
| 106 | ] |
| 107 | ]); |
| 108 | } |
| 109 | |
| 110 | // Render Settings Popup |
| 111 | function render_settings_popup() { |
| 112 | $screen = get_current_screen(); |
| 113 | |
| 114 | if ( 'nav-menus' !== $screen->base ) { |
| 115 | return; |
| 116 | } |
| 117 | |
| 118 | ?> |
| 119 | |
| 120 | <div class="wpr-mm-settings-popup-wrap"> |
| 121 | <div class="wpr-mm-settings-popup"> |
| 122 | <div class="wpr-mm-settings-popup-header"> |
| 123 | <span class="wpr-mm-popup-logo" style="background:url('<?php echo esc_url( WPR_ADDONS_ASSETS_URL . 'img/logo-40x40.png' ); ?>') no-repeat center center / contain;">RE</span> |
| 124 | <span><?php esc_html_e('Royal Mega Menu', 'wpr-addons'); ?></span> |
| 125 | <span class="wpr-mm-popup-title"><?php esc_html_e('Menu Item: ', 'wpr-addons'); ?><span></span></span> |
| 126 | <span class="dashicons dashicons-no-alt wpr-mm-settings-close-popup-btn"></span> |
| 127 | </div> |
| 128 | |
| 129 | <?php $pro_active = ( defined( 'WPR_ADDONS_PRO_VERSION' ) && wpr_fs()->can_use_premium_code() ) ? 'true' : 'false'; ?> |
| 130 | |
| 131 | <div class="wpr-mm-settings-wrap" data-pro-active="<?php echo esc_attr( $pro_active ); ?>"> |
| 132 | <h4><?php esc_html_e('General', 'wpr-addons'); ?></h4> |
| 133 | <div class="wpr-mm-setting wpr-mm-setting-switcher"> |
| 134 | <h4><?php esc_html_e('Enable Mega Menu', 'wpr-addons'); ?></h4> |
| 135 | <input type="checkbox" id="wpr_mm_enable"> |
| 136 | <label for="wpr_mm_enable"></label> |
| 137 | </div> |
| 138 | <div class="wpr-mm-setting"> |
| 139 | <h4><?php esc_html_e('Mega Menu Content', 'wpr-addons'); ?></h4> |
| 140 | <button class="button button-primary wpr-edit-mega-menu-btn"> |
| 141 | <i class="eicon-elementor-square" aria-hidden="true"></i> |
| 142 | <?php esc_html_e('Edit with Elementor', 'wpr-addons'); ?> |
| 143 | </button> |
| 144 | </div> |
| 145 | <div class="wpr-mm-setting"> |
| 146 | <h4><?php esc_html_e('Dropdown Position', 'wpr-addons'); ?></h4> |
| 147 | <select id="wpr_mm_position"> |
| 148 | <option value="default"><?php esc_html_e('Default', 'wpr-addons'); ?></option> |
| 149 | <option value="relative"><?php esc_html_e('Relative', 'wpr-addons'); ?></option> |
| 150 | </select> |
| 151 | </div> |
| 152 | <div class="wpr-mm-setting"> |
| 153 | <h4><?php esc_html_e('Dropdown Width', 'wpr-addons'); ?></h4> |
| 154 | <select id="wpr_mm_width"> |
| 155 | <option value="default"><?php esc_html_e('Default', 'wpr-addons'); ?></option> |
| 156 | <?php if ( !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ) : ?> |
| 157 | <option value="pro-st"><?php esc_html_e('Fit to Section (Pro)', 'wpr-addons'); ?></option> |
| 158 | <?php else: ?> |
| 159 | <option value="stretch"><?php esc_html_e('Fit to Section', 'wpr-addons'); ?></option> |
| 160 | <?php endif; ?> |
| 161 | <option value="full"><?php esc_html_e('Full Width', 'wpr-addons'); ?></option> |
| 162 | <option value="custom"><?php esc_html_e('Custom', 'wpr-addons'); ?></option> |
| 163 | </select> |
| 164 | </div> |
| 165 | <div class="wpr-mm-setting"> |
| 166 | <h4><?php esc_html_e('Custom Width (px)', 'wpr-addons'); ?></h4> |
| 167 | <input type="number" id="wpr_mm_custom_width" value="600"> |
| 168 | </div> |
| 169 | <div class="wpr-mm-setting <?php echo !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ? 'wpr-mm-pro-setting' : ''; ?>"> |
| 170 | <h4><?php esc_html_e('Mobile Sub Content', 'wpr-addons'); ?></h4> |
| 171 | <div> |
| 172 | <select id="wpr_mm_mobile_content"> |
| 173 | <option value="mega"><?php esc_html_e('Mega Menu', 'wpr-addons'); ?></option> |
| 174 | <option value="wp-sub"><?php esc_html_e('WordPress Sub Items', 'wpr-addons'); ?></option> |
| 175 | </select> |
| 176 | |
| 177 | <div class="wpr-mm-pro-radio"> |
| 178 | <input type="radio" name="mc" checked="checked"> |
| 179 | <label>Mega Menu</label><br> |
| 180 | <input type="radio" name="mc"> |
| 181 | <label>WordPress Sub Items</label> |
| 182 | </div> |
| 183 | </div> |
| 184 | </div> |
| 185 | <div class="wpr-mm-setting <?php echo !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ? 'wpr-mm-pro-setting' : ''; ?>"> |
| 186 | <h4><?php esc_html_e('Mobile Sub Render', 'wpr-addons'); ?></h4> |
| 187 | <div> |
| 188 | <select id="wpr_mm_render"> |
| 189 | <option value="default"><?php esc_html_e('Default', 'wpr-addons'); ?></option> |
| 190 | <option value="ajax"><?php esc_html_e('Load with AJAX', 'wpr-addons'); ?></option> |
| 191 | </select> |
| 192 | |
| 193 | <div class="wpr-mm-pro-radio"> |
| 194 | <input type="radio" name="mr" checked="checked"> |
| 195 | <label>Default</label><br> |
| 196 | <input type="radio" name="mr"> |
| 197 | <label>Load with AJAX</label> |
| 198 | </div> |
| 199 | </div> |
| 200 | </div> |
| 201 | |
| 202 | <br> |
| 203 | |
| 204 | <h4 <?php echo !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ? 'class="wpr-mm-pro-heading"' : ''; ?>> |
| 205 | <?php esc_html_e('Icon', 'wpr-addons'); ?> |
| 206 | </h4> |
| 207 | <div <?php echo !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ? 'class="wpr-mm-pro-section"' : ''; ?>> |
| 208 | <div class="wpr-mm-setting wpr-mm-setting-icon"> |
| 209 | <h4><?php esc_html_e('Icon Select', 'wpr-addons'); ?></h4> |
| 210 | <div><span class="wpr-mm-active-icon"><i class="fas fa-ban"></i></span><span><i class="fas fa-angle-down"></i></span></div> |
| 211 | <input type="text" id="wpr_mm_icon_picker" data-alpha="true" value=""> |
| 212 | </div> |
| 213 | <div class="wpr-mm-setting wpr-mm-setting-color"> |
| 214 | <h4><?php esc_html_e('Icon Color', 'wpr-addons'); ?></h4> |
| 215 | <input type="text" id="wpr_mm_icon_color" data-alpha="true" value="rgba(0,0,0,0.6);"> |
| 216 | </div> |
| 217 | <div class="wpr-mm-setting"> |
| 218 | <h4><?php esc_html_e('Icon Size (px)', 'wpr-addons'); ?></h4> |
| 219 | <input type="number" id="wpr_mm_icon_size" value="14"> |
| 220 | </div> |
| 221 | </div> |
| 222 | |
| 223 | <br> |
| 224 | |
| 225 | <h4 <?php echo !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ? 'class="wpr-mm-pro-heading"' : ''; ?>> |
| 226 | <?php esc_html_e('Badge', 'wpr-addons'); ?> |
| 227 | </h4> |
| 228 | <div <?php echo !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ? 'class="wpr-mm-pro-section"' : ''; ?>> |
| 229 | <div class="wpr-mm-setting"> |
| 230 | <h4><?php esc_html_e('Badge Text', 'wpr-addons'); ?></h4> |
| 231 | <input type="text" id="wpr_mm_badge_text" value=""> |
| 232 | </div> |
| 233 | <div class="wpr-mm-setting wpr-mm-setting-color"> |
| 234 | <h4><?php esc_html_e('Badge Text Color', 'wpr-addons'); ?></h4> |
| 235 | <input type="text" id="wpr_mm_badge_color" data-alpha="true" value="rgba(0,0,0,0.6);"> |
| 236 | </div> |
| 237 | <div class="wpr-mm-setting wpr-mm-setting-color"> |
| 238 | <h4><?php esc_html_e('Badge Background Color', 'wpr-addons'); ?></h4> |
| 239 | <input type="text" id="wpr_mm_badge_bg_color" data-alpha="true" value="rgba(0,0,0,0.6);"> |
| 240 | </div> |
| 241 | <div class="wpr-mm-setting wpr-mm-setting-switcher"> |
| 242 | <h4><?php esc_html_e('Enable Animation', 'wpr-addons'); ?></h4> |
| 243 | <input type="checkbox" id="wpr_mm_badge_animation"> |
| 244 | <label for="wpr_mm_badge_animation"></label> |
| 245 | </div> |
| 246 | </div> |
| 247 | </div> |
| 248 | |
| 249 | <div class="wpr-mm-settings-popup-footer"> |
| 250 | <button class="button wpr-save-mega-menu-btn"><?php esc_html_e('Save', 'wpr-addons'); ?></button> |
| 251 | </div> |
| 252 | </div> |
| 253 | </div> |
| 254 | |
| 255 | <!-- Iframe Popup --> |
| 256 | <div class="wpr-mm-editor-popup-wrap"> |
| 257 | <div class="wpr-mm-editor-close-popup-btn"><span class="dashicons dashicons-no-alt"></span></div> |
| 258 | <div class="wpr-mm-editor-popup-iframe"></div> |
| 259 | </div> |
| 260 | <?php |
| 261 | } |
| 262 | |
| 263 | /** |
| 264 | * Allowed mega menu setting keys (whitelist for sanitization). |
| 265 | * |
| 266 | * @return array |
| 267 | */ |
| 268 | function wpr_mega_menu_allowed_settings_keys() { |
| 269 | return [ |
| 270 | 'wpr_mm_enable', |
| 271 | 'wpr_mm_position', |
| 272 | 'wpr_mm_width', |
| 273 | 'wpr_mm_custom_width', |
| 274 | 'wpr_mm_mobile_content', |
| 275 | 'wpr_mm_render', |
| 276 | 'wpr_mm_icon_picker', |
| 277 | 'wpr_mm_icon_color', |
| 278 | 'wpr_mm_icon_size', |
| 279 | 'wpr_mm_badge_text', |
| 280 | 'wpr_mm_badge_color', |
| 281 | 'wpr_mm_badge_bg_color', |
| 282 | 'wpr_mm_badge_animation', |
| 283 | ]; |
| 284 | } |
| 285 | |
| 286 | /** |
| 287 | * Sanitize a single mega menu setting value. |
| 288 | * |
| 289 | * @param mixed $value Raw value. |
| 290 | * @param string $key Setting key. |
| 291 | * @return mixed Sanitized value. |
| 292 | */ |
| 293 | function wpr_sanitize_mega_menu_setting( $value, $key ) { |
| 294 | if ( ! is_scalar( $value ) ) { |
| 295 | return ''; |
| 296 | } |
| 297 | $value = (string) $value; |
| 298 | if ( in_array( $key, [ 'wpr_mm_icon_color', 'wpr_mm_badge_color', 'wpr_mm_badge_bg_color' ], true ) ) { |
| 299 | return sanitize_text_field( $value ); |
| 300 | } |
| 301 | if ( $key === 'wpr_mm_icon_size' || $key === 'wpr_mm_custom_width' ) { |
| 302 | return absint( $value ); |
| 303 | } |
| 304 | return sanitize_text_field( $value ); |
| 305 | } |
| 306 | |
| 307 | // Save Mega Menu Settings |
| 308 | function wpr_save_mega_menu_settings() { |
| 309 | |
| 310 | if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'wpr-mega-menu-js' ) || ! current_user_can( 'manage_options' ) ) { |
| 311 | wp_send_json_error( [ 'message' => 'Invalid request.' ] ); |
| 312 | return; |
| 313 | } |
| 314 | |
| 315 | if ( ! isset( $_POST['item_id'] ) || ! isset( $_POST['item_settings'] ) || ! is_array( $_POST['item_settings'] ) ) { |
| 316 | wp_send_json_error( [ 'message' => 'Missing item_id or item_settings.' ] ); |
| 317 | return; |
| 318 | } |
| 319 | |
| 320 | $item_id = absint( $_POST['item_id'] ); |
| 321 | $item_post = get_post( $item_id ); |
| 322 | if ( ! $item_post || $item_post->post_type !== 'nav_menu_item' ) { |
| 323 | wp_send_json_error( [ 'message' => 'Invalid menu item.' ] ); |
| 324 | return; |
| 325 | } |
| 326 | |
| 327 | $allowed_keys = wpr_mega_menu_allowed_settings_keys(); |
| 328 | $raw = wp_unslash( $_POST['item_settings'] ); |
| 329 | $sanitized = []; |
| 330 | foreach ( $allowed_keys as $key ) { |
| 331 | if ( array_key_exists( $key, $raw ) ) { |
| 332 | $sanitized[ $key ] = wpr_sanitize_mega_menu_setting( $raw[ $key ], $key ); |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | update_post_meta( $item_id, 'wpr-mega-menu-settings', $sanitized ); |
| 337 | wp_send_json_success( $sanitized ); |
| 338 | } |
| 339 | |
| 340 | // Get Menu Items Data |
| 341 | function get_menu_items_data( $menu_id = false ) { |
| 342 | |
| 343 | if ( ! $menu_id ) { |
| 344 | return false; |
| 345 | } |
| 346 | |
| 347 | $menu = wp_get_nav_menu_object( $menu_id ); |
| 348 | |
| 349 | $menu_items = wp_get_nav_menu_items( $menu ); |
| 350 | |
| 351 | if ( ! $menu_items ) { |
| 352 | return false; |
| 353 | } |
| 354 | |
| 355 | return $menu_items; |
| 356 | } |
| 357 | |
| 358 | // Get Mega Menu Item Settings |
| 359 | function get_menu_items_settings() { |
| 360 | $menu_items = get_menu_items_data( get_selected_menu_id() ); |
| 361 | |
| 362 | $settings = []; |
| 363 | |
| 364 | if ( ! $menu_items ) { |
| 365 | return []; |
| 366 | } else { |
| 367 | foreach ( $menu_items as $key => $item_object ) { |
| 368 | $item_id = $item_object->ID; |
| 369 | |
| 370 | $item_meta = get_post_meta( $item_id, 'wpr-mega-menu-settings', true ); |
| 371 | |
| 372 | if ( !empty($item_meta) ) { |
| 373 | $settings[ $item_id ] = $item_meta; |
| 374 | } else { |
| 375 | $settings[ $item_id ] = []; |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | return $settings; |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | /** |
| 384 | * Get the Selected menu ID |
| 385 | * @author Tom Hemsley (https://wordpress.org/plugins/megamenu/) |
| 386 | */ |
| 387 | function get_selected_menu_id() { |
| 388 | $nav_menus = wp_get_nav_menus( array('orderby' => 'name') ); |
| 389 | $menu_count = count( $nav_menus ); |
| 390 | $nav_menu_selected_id = isset( $_REQUEST['menu'] ) ? (int) $_REQUEST['menu'] : 0; |
| 391 | $add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : false; |
| 392 | |
| 393 | $current_menu_id = $nav_menu_selected_id; |
| 394 | |
| 395 | // If we have one theme location, and zero menus, we take them right into editing their first menu |
| 396 | $page_count = wp_count_posts( 'page' ); |
| 397 | $one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) ? true : false; |
| 398 | |
| 399 | // Get recently edited nav menu |
| 400 | $recently_edited = absint( get_user_option( 'nav_menu_recently_edited' ) ); |
| 401 | if ( empty( $recently_edited ) && is_nav_menu( $current_menu_id ) ) { |
| 402 | $recently_edited = $current_menu_id; |
| 403 | } |
| 404 | |
| 405 | // Use $recently_edited if none are selected |
| 406 | if ( empty( $current_menu_id ) && ! isset( $_GET['menu'] ) && is_nav_menu( $recently_edited ) ) { |
| 407 | $current_menu_id = $recently_edited; |
| 408 | } |
| 409 | |
| 410 | // On deletion of menu, if another menu exists, show it |
| 411 | if ( ! $add_new_screen && 0 < $menu_count && isset( $_GET['action'] ) && 'delete' == $_GET['action'] ) { |
| 412 | $current_menu_id = $nav_menus[0]->term_id; |
| 413 | } |
| 414 | |
| 415 | // Set $current_menu_id to 0 if no menus |
| 416 | if ( $one_theme_location_no_menus ) { |
| 417 | $current_menu_id = 0; |
| 418 | } elseif ( empty( $current_menu_id ) && ! empty( $nav_menus ) && ! $add_new_screen ) { |
| 419 | // if we have no selection yet, and we have menus, set to the first one in the list |
| 420 | $current_menu_id = $nav_menus[0]->term_id; |
| 421 | } |
| 422 | |
| 423 | return $current_menu_id; |
| 424 | |
| 425 | } |
| 426 | |
| 427 | // Enqueue Scripts and Styles |
| 428 | function enqueue_scripts( $hook ) { |
| 429 | |
| 430 | // Get Plugin Version |
| 431 | $version = Plugin::instance()->get_version(); |
| 432 | |
| 433 | // Deny if NOT a Menu Page |
| 434 | if ( 'nav-menus.php' == $hook ) { |
| 435 | |
| 436 | // Color Picker |
| 437 | wp_enqueue_style( 'wp-color-picker' ); |
| 438 | wp_enqueue_script( 'wp-color-picker-alpha', WPR_ADDONS_URL .'assets/js/admin/lib/wp-color-picker-alpha.min.js', ['jquery', 'wp-color-picker'], $version, true ); |
| 439 | |
| 440 | // Icon Picker |
| 441 | wp_enqueue_script( 'wpr-iconpicker-js', WPR_ADDONS_URL .'assets/js/admin/lib/iconpicker/fontawesome-iconpicker.min.js', ['jquery'], $version, true ); |
| 442 | wp_enqueue_style( 'wpr-iconpicker-css', WPR_ADDONS_URL .'assets/js/admin/lib/iconpicker/fontawesome-iconpicker.min.css', $version, true ); |
| 443 | wp_enqueue_style( 'wpr-el-fontawesome-css', ELEMENTOR_URL .'assets/lib/font-awesome/css/all.min.css', [], $version ); |
| 444 | |
| 445 | // enqueue CSS |
| 446 | wp_enqueue_style( 'wpr-mega-menu-css', WPR_ADDONS_URL .'assets/css/admin/mega-menu.css', [], $version ); |
| 447 | |
| 448 | // enqueue JS |
| 449 | wp_enqueue_script( 'wpr-mega-menu-js', WPR_ADDONS_URL .'assets/js/admin/mega-menu.js', ['jquery'], $version ); |
| 450 | |
| 451 | wp_localize_script( |
| 452 | 'wpr-mega-menu-js', |
| 453 | 'WprMegaMenuSettingsData', |
| 454 | [ |
| 455 | 'settingsData' => get_menu_items_settings(), |
| 456 | 'nonce' => wp_create_nonce( 'wpr-mega-menu-js' ), |
| 457 | ] |
| 458 | ); |
| 459 | |
| 460 | } |
| 461 | |
| 462 | } |