'wpvr_item', 'post_status' => 'publish', 'orderby' => 'ID', 'order' => 'DESC', 'numberposts' => -1, ]); // Build the tour selection array $tour_options = [0 => __("None", "wpvr")]; foreach ($posts as $post) { $id = $post->ID; $title = $post->post_title ? $post->post_title : __("No title", "wpvr"); $tour_options[$id] = "{$id} : {$title}"; } // Tour selection control $this->addOptionControl([ "type" => "dropdown", "name" => __("Select Tour", "wpvr"), "slug" => "tour_id", "value" => $tour_options ])->rebuildElementOnChange(); // Width controls $this->addOptionControl([ "type" => "textfield", "name" => __("Tour Width", "wpvr"), "slug" => "tour_width", "value" => "600", "condition" => "tour_width_fullwidth=off", ]); $this->addOptionControl([ "type" => "dropdown", "name" => __("Tour Width Unit", "wpvr"), "slug" => "tour_width_unit", "default" => "px", "value" => [ 'px' => __('px', "wpvr"), '%' => __('%', "wpvr"), 'vw' => __('vw', "wpvr"), ], "condition" => "tour_width_fullwidth=off", ])->rebuildElementOnChange(); $this->addOptionControl([ "type" => "dropdown", "name" => __("Tour Width Fullwidth", "wpvr"), "slug" => "tour_width_fullwidth", "default" => "off", "value" => [ 'off' => __('OFF', "wpvr"), 'on' => __('ON', "wpvr"), ] ])->rebuildElementOnChange(); // Height controls $this->addOptionControl([ "type" => "textfield", "name" => __("Tour Height", "wpvr"), "slug" => "tour_height", "value" => "400" ]); $this->addOptionControl([ "type" => "dropdown", "name" => __("Tour Height Unit", "wpvr"), "slug" => "tour_height_unit", "default" => "px", "value" => [ 'px' => __('px', "wpvr"), 'vh' => __('vh', "wpvr"), ] ])->rebuildElementOnChange(); // Mobile-specific height controls $this->addOptionControl([ "type" => "textfield", "name" => __("Tour Mobile Height", "wpvr"), "slug" => "tour_mobile_height", "value" => "300" ])->setParam('description', __('Height on mobile devices. Leave empty to use the main height.', 'wpvr')); $this->addOptionControl([ "type" => "dropdown", "name" => __("Tour Mobile Height Unit", "wpvr"), "slug" => "tour_mobile_height_unit", "default" => "px", "value" => [ 'px' => __('px', "wpvr"), 'vh' => __('vh', "wpvr"), ] ])->rebuildElementOnChange(); // Border radius control $this->addOptionControl([ "type" => "textfield", "name" => __("Tour Radius", "wpvr"), "slug" => "tour_radius", "value" => "0" ]); $this->addOptionControl([ "type" => "dropdown", "name" => __("Tour Radius Unit", "wpvr"), "slug" => "tour_radius_unit", "default" => "px", "value" => [ 'px' => __('px', "wpvr"), ] ])->rebuildElementOnChange(); } /** * Renders the element on the frontend * * @param array $options Values set in the controls * @param array $defaults Default values for all controls * @param array $content Shortcode content for nested elements */ public function render($options, $defaults, $content) { // Get and validate tour ID $id = isset($options['tour_id']) ? absint($options['tour_id']) : 0; if (!$id) { echo '