Need help? Call (888) 688-7527
Need help? Call (888) 688-7527
Random
Name
Price
guests
Bedrooms
add_shortcode('reva_widget', 'reva_generate_widget'); function reva_generate_widget($atts) { global $post, $wpdb; $table_name = $wpdb->prefix . 'reva_pms_mappings'; // Get the Unit ID (PMS ID) from post metadata $unit_id = get_post_meta($post->ID, 'unit_id', true); // Adjust key to match your metadata field name if (!$unit_id) { return '
No Unit ID found for this rental.
'; } // Retrieve Widget ID from the database $widget_id = $wpdb->get_var($wpdb->prepare("SELECT widget_id FROM $table_name WHERE pms_id = %s", $unit_id)); if (!$widget_id) { return 'No widget available for this rental.
'; } // Generate iframe $iframe_src = "https://embed Below is the **complete production-ready code** updated to use the **Unit ID** field from the Rentals custom post type as the `PMS ID`. This version includes all necessary features, including dynamic shortcode generation, admin interface for CSV uploads, and management tools. --- ### **Complete Plugin Code: `reva-widget.php`** ```phpNeed help? Call (888) 688-7527