SHOP BY CATEGORY
NEW ARRIVALS
BEAUTY & ACCESSORIES
BESTSELLERS
<?php function joice_enovathemes_child_scripts() { wp_enqueue_style( 'joice_enovathemes-parent-style', get_template_directory_uri(). '/style.css' ); } add_action( 'wp_enqueue_scripts', 'joice_enovathemes_child_scripts' ); // Add a new tab for Product Care Guide // add_filter('woocommerce_product_tabs', 'add_product_care_guide_tab', 98); function add_product_care_guide_tab($tabs) { // Insert your new tab just before the 'reviews' tab $tabs['product_care_guide_tab'] = array( 'title' => __('Product Care Guides', 'enovathemes-addons'), 'priority' => 25, // Adjust to position the tab correctly 'callback' => 'product_care_guide_tab_content' ); return $tabs; } function product_care_guide_tab_content() { global $post; // Get the value of the ACF field $product_care_guide = get_field('product_care_guide', $post->ID); if ($product_care_guide) { // echo '<h2>' . __('Product Care Guide', 'your-textdomain') . '</h2>'; echo wp_kses_post($product_care_guide); } else { echo '<p>' . __('No product care guide available.', 'enovathemes-addons') . '</p>'; } } // Unhook parent theme function function unhook_parent_feature_one() { remove_action('woocommerce_after_add_to_cart_button', 'joice_enovathemes_buy_now_button'); // Unhook at priority 2 add_action('woocommerce_after_add_to_cart_button', 'dvs_buy_now_button_reorder', 10); // Rehook at priority 1 } add_action('after_setup_theme', 'unhook_parent_feature_one'); add_action( 'woocommerce_after_add_to_cart_button', 'joice_enovathemes_buy_now_button', 10); function dvs_buy_now_button_reorder() { $product_quick_buy = (!empty(get_theme_mod('product_quick_buy'))) ? "true" : "false"; if ($product_quick_buy == "true") { global $product; if ('instock' == $product->get_stock_status()) { echo '<a href="' . esc_url(wc_get_checkout_url()) . '?add-to-cart=' . esc_attr($product->get_id()) . '" class="button single_add_to_cart_button buy-now-button">'.esc_html__("Buy now","joice").'</a>'; } } } function dvs_product_detail_tabs(){ global $product; ?> <br/> <div class="summary-details"> <div class="et-accordion collapsible-false"> <?php $features = get_post_meta($product->get_id(),'enovathemes_addons_features',true) ?> <?php /*if (!empty($features)): */ ?> <div class="accordion-title "><?php echo esc_html__('FEATURES','joice'); ?></div> <!-- add 'active' to remain it open --> <div class="accordion-content "> <!-- add 'active' to remain it open --> <?php $split = preg_split("/(\r?\n)+|(<br\s*\/?>\s*)+/", $features); $output = '<ul class="features">'; foreach($split as $haystack) { $output .= '<li>'.$haystack.'</li>'; } $output .= '</ul>'; echo joice_enovathemes_output_html($output); ?> </div> <?php /*endif */ ?> <?php $product_id = $product->get_id(); $product_care_guide = get_field('product_care_guide', $product_id); $shipping_return = get_field('shipping_and_returns', $product_id); ?> <?php /*if ($product_care_guide): */ // Check if the custom field has content ?> <div class="accordion-title"><?php echo esc_html__('PRODUCT CARE GUIDE', 'joice'); ?></div> <div class="accordion-content"> <?php echo joice_enovathemes_output_html($product_care_guide); ?> </div> <?php /*endif; */ ?> <?php /* if ($shipping_return): */ // Check if the custom field has content ?> <div class="accordion-title"><?php echo esc_html__('SHIPPING AND RETURN', 'joice'); ?></div> <div class="accordion-content"> <?php $shipping_return_text = get_option('shipping_return_text', ''); if (!empty($shipping_return_text)) { echo wpautop($shipping_return_text); } ?> <?php // echo joice_enovathemes_output_html($shipping_return); ?> </div> <?php /* endif; */ ?> </div> </div> <?php } add_action( 'woocommerce_after_add_to_cart_button', 'dvs_product_detail_tabs', 20); // selected categories to display under mobile sticky menu // =============== function mytheme_customize_register($wp_customize) { // Add Section for Product Categories $wp_customize->add_section('product_category_section', array( 'title' => __('Product Categories for Mobile', 'enovathemes-addons'), 'priority' => 30, )); // Get all product categories $categories = get_terms(array( 'taxonomy' => 'product_cat', 'hide_empty' => false, )); // Prepare choices for the setting $category_choices = array(); if (!empty($categories) && !is_wp_error($categories)) { foreach ($categories as $category) { $category_choices[$category->term_id] = $category->name; } } // Add Setting for Product Categories $wp_customize->add_setting('selected_product_categories', array( 'default' => '', 'sanitize_callback' => 'mytheme_sanitize_checkbox_list', 'type' => 'theme_mod', // Ensures value is stored properly 'transport' => 'refresh', // Ensures changes trigger the Publish button )); // Add Custom Control $wp_customize->add_control(new WP_Customize_Category_Checkbox_Control( $wp_customize, 'selected_product_categories', array( 'label' => __('Select Product Categories', 'enovathemes-addons'), 'section' => 'product_category_section', 'settings' => 'selected_product_categories', 'choices' => $category_choices, 'description' => __('Choose which categories should be displayed.', 'enovathemes-addons'), ) )); } // Custom Checkbox List Control if ( ! class_exists( 'WP_Customize_Control' ) ) { require_once ABSPATH . WPINC . '/class-wp-customize-control.php'; } class WP_Customize_Category_Checkbox_Control extends WP_Customize_Control { public $type = 'checkbox-multiple'; public function render_content() { if (empty($this->choices)) { return; } ?> <label><?php echo esc_html($this->label); ?></label> <?php $values = $this->value(); $values = is_array($values) ? $values : explode(',', $values); ?> <div id="customizer-checkboxes"> <?php foreach ($this->choices as $value => $label) : ?> <label> <input type="checkbox" class="customizer-checkbox" value="<?php echo esc_attr($value); ?>" <?php checked(in_array($value, $values)); ?> /> <?php echo esc_html($label); ?> </label><br> <?php endforeach; ?> </div> <input type="hidden" <?php $this->link(); ?> id="customizer-hidden-input" value="<?php echo esc_attr(implode(',', $values)); ?>" /> <script> (function($) { $(document).ready(function() { let checkboxes = $('.customizer-checkbox'); let hiddenInput = $('#customizer-hidden-input'); function updateHiddenInput() { let selectedValues = []; checkboxes.each(function() { if ($(this).is(':checked')) { selectedValues.push($(this).val()); } }); hiddenInput.val(selectedValues.join(',')).trigger('change'); } checkboxes.on('change', updateHiddenInput); }); })(jQuery); </script> <?php } } // Sanitize function for saving checkboxes as a comma-separated string function mytheme_sanitize_checkbox_list($input) { if (is_array($input)) { $input = array_map('absint', $input); // Ensure IDs are integers } else { $input = explode(',', $input); $input = array_map('absint', $input); // Ensure IDs are integers } return implode(',', $input); // Save as comma-separated string } add_action('customize_register', 'mytheme_customize_register'); function remove_parent_dashboard_categories() { remove_action('wp_ajax_fetch_dashboard_categories', 'enovathemes_addons_dashboard_categories'); remove_action('wp_ajax_nopriv_fetch_dashboard_categories', 'enovathemes_addons_dashboard_categories'); add_action('wp_ajax_fetch_dashboard_categories', 'enovathemes_child_addons_dashboard_categories'); add_action('wp_ajax_nopriv_fetch_dashboard_categories', 'enovathemes_child_addons_dashboard_categories'); } add_action('after_setup_theme', 'remove_parent_dashboard_categories'); function enovathemes_child_addons_dashboard_categories() { if (class_exists('Woocommerce')) { // Fetch categories from Customizer $selected_categories = get_theme_mod('selected_product_categories', ''); if (!empty($selected_categories)) { $selected_categories = explode(',', $selected_categories); $selected_categories = array_map('intval', $selected_categories); } // echo "<pre>Formatted Selected Categories: "; // print_r($selected_categories); // echo "</pre>"; // Query WooCommerce product categories $args = array( 'taxonomy' => 'product_cat', 'hide_empty' => false, // Show empty categories too ); if (!empty($selected_categories) && is_array($selected_categories)) { $args['include'] = $selected_categories; } $terms = get_terms($args); // echo "<pre>Fetched Terms: "; // print_r($terms); // echo "</pre>"; if (!empty($terms) && !is_wp_error($terms)) { echo '<ul class="loop-categories">'; foreach ($terms as $term) { $link = get_term_link($term->term_id, 'product_cat'); // echo '<li><a href="' . esc_url($link) . '">' . esc_html($term->name) . '</a></li>'; echo '<li class="category-item"><a href="'.esc_url($link).'">'; echo '<div class="image-container">'; echo '</div>'; echo '<h5>'.esc_html($term->name).'</h5>'; echo '</a></li>'; } echo '</ul>'; } else { echo '<p>No categories found.</p>'; } // return ob_get_clean(); // Get buffer content and clean output } die(); } // add another shipping method // add_filter( 'woocommerce_ship_to_different_address_checked', '__return_true' ); add_filter( 'woocommerce_cart_needs_shipping_address', '__return_true' ); // WPAdmin menu of BHF Features // ========= function bhf_add_admin_menu() { add_menu_page( 'BHF Features', // Page Title 'BHF Features', // Menu Title 'manage_options', // Capability 'bhf_features', // Menu Slug 'bhf_features_page', // Callback Function 'dashicons-admin-generic', // Menu Icon 20 // Position ); } add_action('admin_menu', 'bhf_add_admin_menu'); function bhf_features_page() { ?> <div class="wrap"> <h1><?php esc_html_e('BHF Features', 'mytheme'); ?></h1> <h2 class="nav-tab-wrapper"> <a href="?page=bhf_features&tab=shipping_return" class="nav-tab <?php echo (!isset($_GET['tab']) || $_GET['tab'] == 'shipping_return') ? 'nav-tab-active' : ''; ?>"> <?php esc_html_e('Shipping & Return', 'mytheme'); ?> </a> <a href="?page=bhf_features&tab=another_feature" class="nav-tab <?php echo (isset($_GET['tab']) && $_GET['tab'] == 'another_feature') ? 'nav-tab-active' : ''; ?>"> <?php esc_html_e('Another Feature', 'mytheme'); ?> </a> </h2> <div class="tab-content"> <?php $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'shipping_return'; if ($active_tab == 'shipping_return') { bhf_shipping_return_tab(); } elseif ($active_tab == 'another_feature') { echo "<p>" . esc_html__('This is another feature section.', 'mytheme') . "</p>"; } ?> </div> </div> <?php } function bhf_shipping_return_tab() { // Get saved option $shipping_return_text = get_option('shipping_return_text', ''); ?> <form method="post" action="options.php"> <?php settings_fields('bhf_settings_group'); ?> <?php do_settings_sections('bhf_settings_group'); ?> <table class="form-table"> <tr valign="top"> <th scope="row"><?php esc_html_e('Shipping & Return Policy', 'mytheme'); ?></th> <td> <?php wp_editor($shipping_return_text, 'shipping_return_text', array( 'textarea_name' => 'shipping_return_text', 'media_buttons' => true, 'editor_height' => 250, 'tinymce' => array( 'toolbar1' => 'bold italic underline | alignleft aligncenter alignright | bullist numlist outdent indent | link unlink', 'toolbar2' => 'formatselect blockquote code removeformat', 'statusbar' => true, 'wpautop' => true, 'plugins' => 'link', // Ensure "link" plugin is enabled ), 'quicktags' => true, // Enables Quicktags in Text mode )); ?> </td> </tr> </table> <?php submit_button(); ?> </form> <?php } // Custom Checkbox List Control // if ( ! class_exists( 'WP_Customize_Control' ) ) { // require_once ABSPATH . WPINC . '/class-wp-customize-control.php'; // } function bhf_register_settings() { register_setting('bhf_settings_group', 'shipping_return_text'); } add_action('admin_init', 'bhf_register_settings'); // place order button function enqueue_custom_checkout_script() { if (is_checkout()) { wp_enqueue_script('custom-checkout', get_stylesheet_directory_uri() . '/amazon-pay-btn.js', array('jquery'), null, true); } } // add_action('wp_enqueue_scripts', 'enqueue_custom_checkout_script'); // Mobile bottom bar - ennovatheme-addons.php // ================= function remove_enovathemes_dashboard() { remove_action('wp_footer', 'enovathemes_addons_dashboard'); add_action('wp_footer', 'dvs_enovathemes_addons_dashboard'); } add_action('init', 'remove_enovathemes_dashboard'); function dvs_enovathemes_addons_dashboard(){ $dashboard_list = array(); if (class_exists('Woocommerce')) { $dashboard_list['account'] = esc_html__("Account","enovathemes-addons"); $my_account_link = (class_exists('Woocommerce')) ? get_permalink(get_option('woocommerce_myaccount_page_id')) : home_url('/'); } if (class_exists('Woocommerce')) { $dashboard_list['categories'] = esc_html__("Categories","enovathemes-addons"); $dashboard_list['cart'] = esc_html__("Cart","enovathemes-addons"); $dashboard_list['compare'] = esc_html__("Compare","enovathemes-addons"); $dashboard_list['product-search'] = esc_html__("Search","enovathemes-addons"); } $compare = (get_theme_mod('product_compare') != null && !empty(get_theme_mod('product_compare'))) ? "true" : "false"; $wishlist = (get_theme_mod('product_wishlist') != null && !empty(get_theme_mod('product_wishlist'))) ? "true" : "false"; $modes = et_get_theme_mods(); $blog_sidebar = (isset($modes['blog_sidebar']) && $modes['blog_sidebar'] == 1) ? true : false; $post_sidebar = (isset($modes['post_sidebar']) && $modes['post_sidebar'] == 1) ? true : false; $shop_sidebar = (isset($modes['shop_sidebar']) && $modes['shop_sidebar'] == 1) ? true : false; if ($wishlist == "false") {unset($dashboard_list['wishlist']);} if ($compare == "false") {unset($dashboard_list['compare']);} if (is_active_sidebar('shop-widgets') && empty($shop_sidebar) && !defined('ENOVATHEMES_ADDONS')) { $shop_sidebar = 'true'; } if (is_active_sidebar('blog-widgets') && empty($blog_sidebar) && !defined('ENOVATHEMES_ADDONS')) { $blog_sidebar = 'true'; } if ( (is_singular('post') && !empty($post_sidebar)) || ((is_home() || is_category() || is_tag()) && !empty($blog_sidebar)) ) { $dashboard_list['post-sidebar'] = esc_html__("Sidebar","enovathemes-addons"); } elseif(class_exists('Woocommerce') && ((is_shop() || is_tax('product_cat') || is_tax('product_tag')) && !empty($shop_sidebar))) { $dashboard_list['shop-filter'] = esc_html__("Filter","enovathemes-addons"); unset($dashboard_list['product-search']); } $dashboard_list['arrow-top'] = esc_html__("Top","enovathemes-addons"); echo '<ul class="sticky-dashboard">'; foreach ($dashboard_list as $item => $label) { $href = $class = $item_class = ''; switch ($item) { case 'account': $href = (is_user_logged_in()) ? '#' : $my_account_link; break; case 'categories': $href = '#'; break; case 'cart': $href = '#'; $item_class = ' mini-cart'; // $class = 'cart-toggle hbe-toggle'; $class = 'xoo-wsc-cart-trigger'; break; case 'wishlist': $href = $my_account_link.'wishlist'; break; case 'compare': $href = '#'; $class = 'et-compare-icon'; break; case 'shop-filter': $href = '#'; $item_class = ' active'; $class = 'content-sidebar-toggle shop'; break; case 'product-search': $href = '#'; $item_class = ' et-product-search-toggle et-product-search'; $class = 'search-toggle toggle hbe-toggle toggle-icon'; break; case 'post-sidebar': $href = '#'; $class = 'post-sidebar content-sidebar-toggle blog'; break; case 'arrow-top': $href = '#wrap'; $class = 'to-top'; break; } echo '<li class="'.esc_attr($item).$item_class.'" ><a class="'.esc_attr($class).'" href="'.esc_url($href).'" title="'.esc_attr($label).'">'; if('compare' == $item){ echo '<span class="compare-contents"></span>'; } elseif('wishlist' == $item){ echo '<span class="wishlist-contents"></span>'; } // elseif('cart' == $item){ // echo '<span class="cart-info"><span class="cart-contents"></span></span>'; // } echo esc_html($label).'</a>'; // if('cart' == $item){ // $output = '<div class="cart-box box">'; // $output .= '<div class="cart-toggle cart-off-toggle"></div><div class="et-clearfix"></div>'; // if (class_exists('Woocommerce')){ // $output .= enovathemes_addons_get_the_widget( 'WC_Widget_Cart', 'title=Cart' ); // } else { // $output .= esc_html__('Please install Woocommerce','enovathemes-addons'); // } // $output .= '</div>'; // echo $output; // } elseif('product-search' == $item){ if('product-search' == $item){ $instance = array( 'title' => '', 'category' => true, 'SKU' => true, 'description' => false, 'in_tag' => true, 'in_attr' => true, ); $args = array( 'before_title' => '<h5 class="widget_title">', 'after_title' => '</h5>', ); $output = '<div class="search-box">'; $output .= '<div class="search-toggle-off et-icon size-medium"></div>'; $output .= '<div class="et-clearfix"></div>'; $output .= enovathemes_addons_get_the_widget( 'Enovathemes_Addons_WP_Product_Search', $instance,$args); $output .= '</div>'; echo $output; } echo '</li>'; } echo '</ul>'; } // hide wp-admin errors function my_custom_admin_styles() { wp_enqueue_style( 'my-admin-style', // handle get_template_directory_uri() . '/admin-style.css', // path to your stylesheet false, '1.0.0' ); } add_action('admin_enqueue_scripts', 'my_custom_admin_styles'); add_action('wp_footer', 'custom_place_order_class_script', 100); function custom_place_order_class_script() { if (!is_checkout()) return; ?> <script> (function($) { function updateButtonClass() { var selected = $('input[name="payment_method"]:checked').val(); var $button = $('#place_order'); if ($button.length === 0) return; // Remove old classes $button.removeClass(function(index, className) { return (className.match(/(^|\s)btn-gateway-\S+/g) || []).join(' '); }); // Add new class var gatewayClass = 'btn-gateway-' + selected; $button.addClass(gatewayClass); console.log('[Gateway Debug] Added button class:', gatewayClass); console.log('[Gateway Debug] selected:', selected); // Set custom text for authnet if (selected === 'authorizenet') { $button.text('Pay securely with Authorize.net'); } else { $button.text($button.attr('data-value') || 'Place order'); } } $(document).ready(function() { // Initial call updateButtonClass(); // When payment method changes $('form.checkout').on('change', 'input[name="payment_method"]', updateButtonClass); // Also when checkout is updated (AJAX) — WooCommerce often re-renders parts $(document.body).on('updated_checkout', function() { console.log('[Gateway Debug] Checkout updated via AJAX'); updateButtonClass(); }); }); })(jQuery); </script> <?php } // Code for quickview window add_action('init', 'remove_woogallery_from_quickview', 20); function remove_woogallery_from_quickview() { if (class_exists('Gallery_Slider_For_Woocommerce_Public')) { remove_action('woocommerce_before_single_product_summary', array('Gallery_Slider_For_Woocommerce_Public', 'gallery_slider_html'), 10); } } add_action('yith_wcqv_product_image', 'restore_default_woo_gallery', 5); function restore_default_woo_gallery() { wc_get_template('single-product/product-image.php'); } if ( ! function_exists('bhf_why_buy_section') ) { add_action('woocommerce_after_add_to_cart_form', 'bhf_why_buy_section', 5); function bhf_why_buy_section() { if ( ! is_product() ) return; echo '<div class="bhf-why-buy"> <div class="bhf-why-buy-grid"> <div class="bhf-why-item"> <div class="bhf-why-icon"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="3" width="15" height="13" rx="1"/><path d="M16 8h4a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-1"/><circle cx="8.5" cy="18.5" r="1.5"/><circle cx="18.5" cy="18.5" r="1.5"/></svg> </div> <div class="bhf-why-text"> <span class="bhf-why-title">FREE SHIPPING</span> <span class="bhf-why-sub">On orders over $75</span> </div> </div> <div class="bhf-why-item"> <div class="bhf-why-icon"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> </div> <div class="bhf-why-text"> <span class="bhf-why-title">SECURE PAYMENT</span> <span class="bhf-why-sub">100% protected checkout</span> </div> </div> <div class="bhf-why-item"> <div class="bhf-why-icon"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 11-2.12-9.36L23 10"/></svg> </div> <div class="bhf-why-text"> <span class="bhf-why-title">EASY RETURNS</span> <span class="bhf-why-sub">30-day hassle-free policy</span> </div> </div> <div class="bhf-why-item"> <div class="bhf-why-icon"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg> </div> <div class="bhf-why-text"> <span class="bhf-why-title">PREMIUM QUALITY</span> <span class="bhf-why-sub">Curated luxury pieces</span> </div> </div> </div> </div>'; } } // ============================================================ // JEWELRY + BEAUTY STORE — REBUILD HEADER NAVIGATION MENU // ============================================================ function bhf_add_cat_menu_item( $menu_id, $slug, $label, $position, $parent = 0 ) { $term = get_term_by( 'slug', $slug, 'product_cat' ); if ( ! $term ) return 0; return wp_update_nav_menu_item( $menu_id, 0, array( 'menu-item-title' => $label, 'menu-item-object' => 'product_cat', 'menu-item-object-id' => $term->term_id, 'menu-item-type' => 'taxonomy', 'menu-item-status' => 'publish', 'menu-item-position' => $position, 'menu-item-parent-id' => $parent, ) ); } add_action( 'init', 'bhf_rebuild_jewelry_beauty_menu' ); function bhf_rebuild_jewelry_beauty_menu() { if ( get_option( 'bhf_jewelry_beauty_menu_v1' ) ) return; $menu_id = 1834; // Header menu // Remove all existing items $existing = wp_get_nav_menu_items( $menu_id, array( 'update_post_term_cache' => false ) ); if ( $existing ) { foreach ( $existing as $item ) { wp_delete_post( $item->ID, true ); } } // 1. NEW IN $new_in = bhf_add_cat_menu_item( $menu_id, 'new-in', 'NEW IN', 1 ); bhf_add_cat_menu_item( $menu_id, 'new-in-accessories', 'New In Jewelry', 2, $new_in ); bhf_add_cat_menu_item( $menu_id, 'new-in-beauty', 'New In Beauty', 3, $new_in ); // 2. RINGS bhf_add_cat_menu_item( $menu_id, 'rings', 'RINGS', 4 ); // 3. NECKLACES bhf_add_cat_menu_item( $menu_id, 'necklaces-and-pendants', 'NECKLACES', 5 ); // 4. EARRINGS bhf_add_cat_menu_item( $menu_id, 'earrings-luxe-925-sterling-silver-jewelry', 'EARRINGS', 6 ); // 5. BRACELETS bhf_add_cat_menu_item( $menu_id, 'bracelets', 'BRACELETS', 7 ); // 6. FINE JEWELRY (dropdown) $fine = bhf_add_cat_menu_item( $menu_id, 'luxe-925-sterling-silver-jewelry', 'FINE JEWELRY', 8 ); bhf_add_cat_menu_item( $menu_id, 'rings', 'Rings', 9, $fine ); bhf_add_cat_menu_item( $menu_id, 'necklaces-and-pendants', 'Necklaces & Pendants', 10, $fine ); bhf_add_cat_menu_item( $menu_id, 'earrings-luxe-925-sterling-silver-jewelry', 'Earrings', 11, $fine ); bhf_add_cat_menu_item( $menu_id, 'bracelets', 'Bracelets', 12, $fine ); bhf_add_cat_menu_item( $menu_id, 'jewelry-sets', 'Jewelry Sets', 13, $fine ); bhf_add_cat_menu_item( $menu_id, 'glam-fashion-jewelry', 'GLAM Fashion', 14, $fine ); bhf_add_cat_menu_item( $menu_id, 'shop-all-925-sterling-silver-luxe-925-sterling-silver-jewelry', 'Shop All Fine Jewelry', 15, $fine ); // 7. BEAUTY (dropdown) $beauty = bhf_add_cat_menu_item( $menu_id, 'beauty', 'BEAUTY', 16 ); bhf_add_cat_menu_item( $menu_id, 'face-beauty', 'Face & Skincare', 17, $beauty ); bhf_add_cat_menu_item( $menu_id, 'beauty-tools-and-brushes', 'Beauty Tools', 18, $beauty ); bhf_add_cat_menu_item( $menu_id, 'shop-all-beauty', 'Shop All Beauty', 19, $beauty ); // 8. COLLECTIONS (VIP / Red Carpet) $coll = bhf_add_cat_menu_item( $menu_id, 'vip-red-carpet', 'COLLECTIONS', 20 ); bhf_add_cat_menu_item( $menu_id, 'jewelry-vip-red-carpet', 'Red Carpet Jewelry', 21, $coll ); bhf_add_cat_menu_item( $menu_id, 'watches', 'Watches', 22, $coll ); // 9. SALE bhf_add_cat_menu_item( $menu_id, 'sale', 'SALE', 23 ); // 10. REGISTER (custom link) wp_update_nav_menu_item( $menu_id, 0, array( 'menu-item-title' => 'REGISTER', 'menu-item-url' => '/my-account/', 'menu-item-type' => 'custom', 'menu-item-status' => 'publish', 'menu-item-position' => 24, ) ); update_option( 'bhf_jewelry_beauty_menu_v1', true ); } // ============================================================ // DRIP NEWSLETTER — ELEMENTOR FORM + JS IDENTIFY // ============================================================ add_action( 'wp_footer', 'bhf_drip_newsletter_js' ); function bhf_drip_newsletter_js() { ?> <script> (function($){ // Elementor Pro form success → Drip identify $(document).on('submit_success', '.elementor-form', function(e, response) { var email = $(this).find('input[type="email"]').val(); if ( email && email.indexOf('@') > 0 && typeof _dcq !== 'undefined' ) { _dcq.push(['identify', { email: email, tags: ['newsletter', 'beverly-hills-jewelry'], custom_fields: { source: 'footer_newsletter_form' }, success: function(){ console.log('BHF: subscribed to Drip', email); } }]); } }); // Joice theme Mailchimp widget → redirect to Drip instead $(document).on('submit', '.et-mailchimp-form', function(e) { var email = $(this).find('input[name="email"]').val(); if ( email && typeof _dcq !== 'undefined' ) { _dcq.push(['identify', { email: email, tags: ['newsletter', 'beverly-hills-jewelry'], }]); } }); })(jQuery); </script> <?php } // ============================================================ // DRIP NEWSLETTER — SERVER-SIDE ELEMENTOR FORM HANDLER // ============================================================ add_action( 'elementor_pro/forms/new_record', 'bhf_elementor_form_drip_subscribe', 10, 2 ); function bhf_elementor_form_drip_subscribe( $record, $ajax_handler ) { // Get Drip account credentials from WooCommerce Drip plugin settings $drip_settings = get_option( 'woocommerce_drip_settings', array() ); $account_id = isset( $drip_settings['account_id'] ) ? $drip_settings['account_id'] : ''; $access_token = isset( $drip_settings['access_token'] ) ? $drip_settings['access_token'] : ''; // Also try alternate option keys used by the Drip plugin if ( empty( $access_token ) ) { $access_token = get_option( 'drip_access_token', '' ); } if ( empty( $account_id ) ) { $account_id = '8497949'; // Hardcoded fallback (confirmed in WooCommerce > Integration) } if ( empty( $access_token ) || empty( $account_id ) ) return; // Extract email from form fields $fields = $record->get( 'fields' ); $email = ''; foreach ( $fields as $field ) { if ( in_array( $field['type'], array( 'email', 'text' ) ) && is_email( $field['value'] ) ) { $email = sanitize_email( $field['value'] ); break; } } if ( empty( $email ) ) return; // POST to Drip Subscribers API wp_remote_post( "https://api.getdrip.com/v2/{$account_id}/subscribers", array( 'headers' => array( 'Authorization' => 'Bearer ' . $access_token, 'Content-Type' => 'application/json', 'User-Agent' => 'BeverlyHillsFashion-WP/1.0', ), 'body' => wp_json_encode( array( 'subscribers' => array( array( 'email' => $email, 'tags' => array( 'newsletter', 'jewelry-beauty' ), 'custom_fields' => array( 'source' => 'footer_newsletter' ), ) ), ) ), 'timeout' => 8, ) ); } // ============================================================ // JEWELRY + BEAUTY STORE — REBUILD MOBILE MENU (ID 1835) // ============================================================ add_action( 'init', 'bhf_rebuild_mobile_menu' ); function bhf_rebuild_mobile_menu() { if ( get_option( 'bhf_mobile_menu_v1' ) ) return; $menu_id = 1835; $existing = wp_get_nav_menu_items( $menu_id, array( 'update_post_term_cache' => false ) ); if ( $existing ) { foreach ( $existing as $item ) { wp_delete_post( $item->ID, true ); } } $new_in = bhf_add_cat_menu_item( $menu_id, 'new-in', 'NEW IN', 1 ); bhf_add_cat_menu_item( $menu_id, 'new-in-accessories', 'New In Jewelry', 2, $new_in ); bhf_add_cat_menu_item( $menu_id, 'new-in-beauty', 'New In Beauty', 3, $new_in ); bhf_add_cat_menu_item( $menu_id, 'rings', 'RINGS', 4 ); bhf_add_cat_menu_item( $menu_id, 'necklaces-and-pendants', 'NECKLACES', 5 ); bhf_add_cat_menu_item( $menu_id, 'earrings-luxe-925-sterling-silver-jewelry', 'EARRINGS', 6 ); bhf_add_cat_menu_item( $menu_id, 'bracelets', 'BRACELETS', 7 ); $fine = bhf_add_cat_menu_item( $menu_id, 'luxe-925-sterling-silver-jewelry', 'FINE JEWELRY', 8 ); bhf_add_cat_menu_item( $menu_id, 'rings', 'Rings', 9, $fine ); bhf_add_cat_menu_item( $menu_id, 'necklaces-and-pendants', 'Necklaces & Pendants', 10, $fine ); bhf_add_cat_menu_item( $menu_id, 'earrings-luxe-925-sterling-silver-jewelry', 'Earrings', 11, $fine ); bhf_add_cat_menu_item( $menu_id, 'bracelets', 'Bracelets', 12, $fine ); bhf_add_cat_menu_item( $menu_id, 'jewelry-sets', 'Jewelry Sets', 13, $fine ); bhf_add_cat_menu_item( $menu_id, 'shop-all-925-sterling-silver-luxe-925-sterling-silver-jewelry', 'Shop All Fine Jewelry', 14, $fine ); $beauty = bhf_add_cat_menu_item( $menu_id, 'beauty', 'BEAUTY', 15 ); bhf_add_cat_menu_item( $menu_id, 'face-beauty', 'Face & Skincare', 16, $beauty ); bhf_add_cat_menu_item( $menu_id, 'beauty-tools-and-brushes', 'Beauty Tools', 17, $beauty ); bhf_add_cat_menu_item( $menu_id, 'shop-all-beauty', 'Shop All Beauty', 18, $beauty ); $coll = bhf_add_cat_menu_item( $menu_id, 'vip-red-carpet', 'COLLECTIONS', 19 ); bhf_add_cat_menu_item( $menu_id, 'jewelry-vip-red-carpet', 'Red Carpet Jewelry', 20, $coll ); bhf_add_cat_menu_item( $menu_id, 'glam-fashion-jewelry', 'GLAM Jewelry', 21, $coll ); bhf_add_cat_menu_item( $menu_id, 'watches', 'Watches', 22, $coll ); bhf_add_cat_menu_item( $menu_id, 'sale', 'SALE', 23 ); wp_update_nav_menu_item( $menu_id, 0, array( 'menu-item-title' => 'REGISTER', 'menu-item-url' => '/my-account/', 'menu-item-type' => 'custom', 'menu-item-status' => 'publish', 'menu-item-position' => 24 ) ); update_option( 'bhf_mobile_menu_v1', true ); } // ============================================================== // BHF: Show ONLY Jewelry, Beauty, Accessories — hide all clothing // ============================================================== if ( ! function_exists( 'bhf_get_clothing_cat_ids' ) ) : function bhf_get_clothing_cat_ids() { return array( 835,891,893,894,895,896,836,1458,838,839,840,841,844,854, 855,862,863,864,867,872,890,935,941,1022,1219,1289,1100 ); } add_action( 'woocommerce_product_query', 'bhf_exclude_clothing_from_shop' ); function bhf_exclude_clothing_from_shop( $q ) { if ( ! $q->is_main_query() ) return; $tq = (array) $q->get('tax_query'); $tq[] = array('taxonomy'=>'product_cat','field'=>'term_id','terms'=>bhf_get_clothing_cat_ids(),'operator'=>'NOT IN'); $q->set('tax_query',$tq); } add_filter( 'woocommerce_shortcode_products_query', 'bhf_exclude_clothing_from_shortcode' ); function bhf_exclude_clothing_from_shortcode( $query_args ) { $tq = isset($query_args['tax_query']) ? (array)$query_args['tax_query'] : array(); $tq[] = array('taxonomy'=>'product_cat','field'=>'term_id','terms'=>bhf_get_clothing_cat_ids(),'operator'=>'NOT IN'); $query_args['tax_query'] = $tq; return $query_args; } add_action( 'pre_get_posts', 'bhf_exclude_clothing_archives' ); function bhf_exclude_clothing_archives( $q ) { if ( is_admin() || ! $q->is_main_query() ) return; if ( ! ( is_shop() || is_product_category() || is_product_tag() ) ) return; $tq = (array) $q->get('tax_query'); $tq[] = array('taxonomy'=>'product_cat','field'=>'term_id','terms'=>bhf_get_clothing_cat_ids(),'operator'=>'NOT IN'); $q->set('tax_query',$tq); } endif; // ============================================================ // BHF SHOP CATEGORY CAROUSEL (Joice-style) // ============================================================ if ( ! function_exists( 'bhf_shop_cat_carousel' ) ) : function bhf_shop_cat_carousel() { if ( ! ( is_shop() || is_product_category() ) ) return; $clothing = bhf_get_clothing_cat_ids(); $args = array( 'taxonomy' => 'product_cat', 'hide_empty' => true, 'exclude' => $clothing, 'orderby' => 'name', 'order' => 'ASC', 'number' => 40, ); $cats = get_terms( $args ); if ( empty( $cats ) || is_wp_error( $cats ) ) return; $current = is_product_category() ? get_queried_object()->term_id : 0; $all_active = ( $current === 0 ) ? ' active' : ''; echo '