Automated Cat to Nav

add_action(‘created_category’, ‘auto_add_category_to_primary_theme_menu’, 10, 2); function auto_add_category_to_primary_theme_menu($term_id, $tt_id) { // Get menu assigned to the “primary” theme location $locations = get_nav_menu_locations(); if (!isset($locations[‘primary’])) return; $menu_id = $locations[‘primary’]; $category = get_category($term_id); if (!$category || is_wp_error($category)) return; // Prevent duplicates $items = wp_get_nav_menu_items($menu_id);…Continue reading

Accordion Template Helper

/** * For the Accordion Template, this is a helper script * * For support, please visit: https://www.facebook.com/groups/wpformsvip */ add_action( ‘wp_head’, function () { ?>Continue reading

Mobile Menu Shortcode

function mobile_menu_shortcode( $atts ) { $atts = shortcode_atts( array( ‘menu_id’ => ”, // Optional menu ID ‘svg_url’ => ”, // Optional SVG URL for submenu toggle icon ), $atts, ‘mobile_menu’ ); // If no menu ID provided, get the first…Continue reading

Create a Custom Shipping Method in WooCommerce

add_filter(‘woocommerce_shipping_methods’, ‘register_wholesale_shipping_method’); function register_wholesale_shipping_method($methods) { $methods[‘wholesale_shipping’] = ‘WC_Shipping_Wholesale’; return $methods; } if (!class_exists(‘WC_Shipping_Wholesale’)) { class WC_Shipping_Wholesale extends WC_Shipping_Method { public function __construct($instance_id = 0) { $this->id = ‘wholesale_shipping’; $this->instance_id = absint($instance_id); $this->method_title = __(‘Wholesale Shipping’); $this->method_description = __(‘Flat rate shipping…Continue reading

WooCommerce: Restrict Shipping Methods by User Role (Logged In, Logged Out, Custom Roles)

// 💡 Load multiselect field to all shipping methods add_action(‘woocommerce_init’, ‘woocommerce_shipping_instances_form_fields_filters’); function woocommerce_shipping_instances_form_fields_filters() { foreach (WC()->shipping->get_shipping_methods() as $shipping_method) { add_filter(‘woocommerce_shipping_instance_form_fields_’ . $shipping_method->id, ‘add_allowed_roles_field_to_shipping_methods’); } } // 🎯 Add multiselect role option (styled like tag input) function add_allowed_roles_field_to_shipping_methods($settings) { $settings[‘allowed_user_roles’] =…Continue reading

Evocalux Static Test

function evocalux_user_static_test() { return ‘ It works! 💥 ‘; } add_shortcode(‘test_this’, ‘evocalux_user_static_test’);Continue reading

EvocaLux Shortcode Debugger2

function evocalux_user_debugger_shortcode() { return ‘ ✨ Shortcode is working ✨ ‘; } add_shortcode(‘evocalux_user’, ‘evocalux_user_debugger_shortcode’);Continue reading