Type: php
Side Menu
/** * Print Portals – Left Sidebar Menu (v3) * * – Shows for ALL users. * – Orders + Address Book: * – Logged out => /login * – Logged in => /orders, /address-book * – Bottom button: *…Continue reading
Orders Page & Approvals
/** * Your Orders (AJAX Grid + Viewer) + Optional Approvals + Custom Emails + Custom Thank You * + Friendly /orders/{order-number} + AJAX pagination (50 per page) with NO page refresh * * Shortcodes: * [your_orders] * * IMPORTANT:…Continue reading
Enqueue Scrips !important
add_action( ‘wp_enqueue_scripts’, function() { // 1) Make sure WooCommerce’s checkout.js is loaded (so it will set up wc_checkout_params) if ( ! wp_script_is( ‘wc-checkout’, ‘enqueued’ ) ) { wp_enqueue_script( ‘wc-checkout’ ); } // 2) Then load *your* script *after* it, so…Continue reading
Address Book.php
/** * Address Book – Main PHP (safe-merge + defaults-in-JSON) */ /* ——————————— 1) Enqueue scripts & styles ———————————–*/ add_action(‘wp_enqueue_scripts’, function() { wp_enqueue_script( ‘address-book-js’, get_stylesheet_directory_uri() . ‘/js/address-book.js’, [‘jquery’], ‘1.1’, true ); wp_localize_script(‘address-book-js’,’addressBookParams’,[ ‘ajax_url’ => admin_url(‘admin-ajax.php’), ‘nonce’ => wp_create_nonce(‘address_book_nonce’), ]); wp_enqueue_style(…Continue reading
Coupon AJAX.php
/** * Snippet Name: AJAX Coupon Handlers * Description: Handles apply/remove coupon via WC AJAX endpoints. * Execution: Run Everywhere (Front & Admin) * Priority: 10 */ // 1) APPLY COUPON via AJAX add_action( ‘wc_ajax_apply_coupon’, ‘wc_custom_apply_coupon_ajax’, 5 ); add_action( ‘wc_ajax_nopriv_apply_coupon’,…Continue reading
Custom Checkout.php
// ====================================================== // Custom 2-Step Checkout (guest gating + autofill guards) // + Step 1 Review Items (AJAX remove) — FULL FILE // // Includes: // – Guest: billing_email shown in Delivery > New Address only // – Guest: can…Continue reading
Untitled Snippet
add_action(‘wp_ajax_tssh_send_results’, ‘tssh_send_results’); add_action(‘wp_ajax_nopriv_tssh_send_results’, ‘tssh_send_results’); function tssh_send_results() { $nonce = isset($_POST[‘nonce’]) ? sanitize_text_field($_POST[‘nonce’]) : ”; if (!wp_verify_nonce($nonce, ‘tssh_quiz_nonce’)) { wp_send_json_error(‘Security check failed. Please refresh and try again.’); } $email = isset($_POST[’email’]) ? sanitize_email($_POST[’email’]) : ”; if (!$email || !is_email($email)) { wp_send_json_error(‘Please…Continue reading
Untitled Snippet
Cortex Image Meta API (copy)
/** * Cortex Image Meta API – REST Endpoints for WordPress Image Optimization * v1.0 – Separated from Cortex SEO Meta API * * For image alt text, titles, captions, and optimization scoring. * Works with RankMath focus keywords for…Continue reading