ID, '_tour_price', true); $duration = get_post_meta($post->ID, '_tour_duration', true); $location = get_post_meta($post->ID, '_tour_location', true); $experience_journey = get_post_meta($post->ID, '_experience_journey', true); $daily_program = get_post_meta($post->ID, '_daily_program', true); $included_items = get_post_meta($post->ID, '_included_items', true); $not_included_items = get_post_meta($post->ID, '_not_included_items', true); $available_extras = get_post_meta($post->ID, '_available_extras', true); $day_type_label = get_post_meta($post->ID, '_day_type_label', true); $hero_image = get_post_meta($post->ID, '_hero_image', true); $guide_image = get_post_meta($post->ID, '_guide_image', true); $guide_name = get_post_meta($post->ID, '_guide_name', true); $guide_title = get_post_meta($post->ID, '_guide_title', true); if (!is_array($daily_program)) $daily_program = array(); if (!is_array($included_items)) $included_items = array(); if (!is_array($not_included_items)) $not_included_items = array(); if (!is_array($available_extras)) $available_extras = array(); if (empty($day_type_label)) $day_type_label = 'Day'; wp_nonce_field('individual_tour_nonce', 'individual_tour_nonce'); ?>

Basic Information

Select which Experience Journey this tour belongs to.

Hero Image

Recommended size: 1920x1080px. This image will be displayed at the top of your tour page.

Tour Gallery

Daily Program

This label will be displayed before each day number (e.g. " 1", " 2", etc.)

$day) : ?>

Included in Price

$item) : ?>

Not Included in Price

$item) : ?>

Available Extras

$extra) : ?>

Check "Per day per person" for extras where the price should be multiplied by both the number of days and participants (e.g. bike rental at €20/day/person for an 8-day tour with 3 participants would cost €480).

Guide Information

Guide

FAQ - Frequently Asked Questions

ID, '_tour_faqs', true); if (!is_array($faqs)) $faqs = array(); foreach ($faqs as $index => $faq) : ?>
'sanitize_text_field', 'tour_duration' => 'sanitize_text_field', 'tour_location' => 'sanitize_text_field', 'experience_journey' => 'absint', 'hero_image' => 'absint', 'guide_image' => 'absint', 'guide_name' => 'sanitize_text_field', 'guide_title' => 'sanitize_text_field', 'day_type_label' => 'sanitize_text_field' ); // Debug izpis za administratorje if (current_user_can('administrator')) { error_log('Saving tour meta data:'); error_log('POST data: ' . print_r($_POST, true)); } foreach ($fields as $field => $sanitize_callback) { if (isset($_POST[$field])) { $value = call_user_func($sanitize_callback, $_POST[$field]); update_post_meta($post_id, '_' . $field, $value); // Debug izpis za administratorje if (current_user_can('administrator')) { error_log("Saving field {$field} with value: {$value}"); } } } // Shrani galerijo if (isset($_POST['tour_gallery'])) { $gallery_images = array_filter(explode(',', sanitize_text_field($_POST['tour_gallery']))); update_post_meta($post_id, '_tour_gallery', $gallery_images); } // Shrani dnevni program if (isset($_POST['daily_program'])) { $daily_program = array(); foreach ($_POST['daily_program'] as $index => $day) { if (!empty($day['title']) || !empty($day['description'])) { $daily_program[] = array( 'title' => sanitize_text_field($day['title']), 'description' => wp_kses_post($day['description']) ); } } update_post_meta($post_id, '_daily_program', $daily_program); } // Shrani vključene elemente if (isset($_POST['included_items'])) { $included_items = array_filter(array_map('sanitize_text_field', $_POST['included_items'])); update_post_meta($post_id, '_included_items', $included_items); } // Shrani nevključene elemente if (isset($_POST['not_included_items'])) { $not_included_items = array_filter(array_map('sanitize_text_field', $_POST['not_included_items'])); update_post_meta($post_id, '_not_included_items', $not_included_items); } // Shrani available extras if (isset($_POST['available_extras'])) { $available_extras = array(); foreach ($_POST['available_extras'] as $extra) { if (!empty($extra['name'])) { $available_extras[] = array( 'name' => sanitize_text_field($extra['name']), 'price' => floatval($extra['price']), 'per_day_per_person' => isset($extra['per_day_per_person']) ? true : false ); } } update_post_meta($post_id, '_available_extras', $available_extras); } // Shrani FAQ vprašanja in odgovore if (isset($_POST['tour_faqs'])) { $faqs = array(); foreach ($_POST['tour_faqs'] as $faq) { if (!empty($faq['question']) || !empty($faq['answer'])) { $faqs[] = array( 'question' => sanitize_text_field($faq['question']), 'answer' => wp_kses_post($faq['answer']) ); } } update_post_meta($post_id, '_tour_faqs', $faqs); } } add_action('save_post_individual_tour', 'save_individual_tour_meta'); // Dodaj podporo za naslovno sliko add_theme_support('post-thumbnails'); // Registriraj meta polja za REST API function register_tour_meta_fields() { // Registracija meta polj za Individual Tour register_post_meta('individual_tour', '_daily_program', array( 'type' => 'array', 'single' => true, 'show_in_rest' => array( 'schema' => array( 'type' => 'array', 'items' => array( 'type' => 'object', 'properties' => array( 'title' => array('type' => 'string'), 'description' => array('type' => 'string') ) ) ) ) )); register_post_meta('individual_tour', '_included_items', array( 'type' => 'array', 'single' => true, 'show_in_rest' => array( 'schema' => array( 'type' => 'array', 'items' => array('type' => 'string') ) ) )); register_post_meta('individual_tour', '_not_included_items', array( 'type' => 'array', 'single' => true, 'show_in_rest' => array( 'schema' => array( 'type' => 'array', 'items' => array('type' => 'string') ) ) )); register_post_meta('individual_tour', '_available_extras', array( 'type' => 'array', 'single' => true, 'show_in_rest' => array( 'schema' => array( 'type' => 'array', 'items' => array( 'type' => 'object', 'properties' => array( 'title' => array('type' => 'string'), 'price' => array('type' => 'number') ) ) ) ) )); // Registracija ostalih meta polj register_post_meta('individual_tour', '_tour_price', array( 'type' => 'number', 'single' => true, 'show_in_rest' => true )); register_post_meta('individual_tour', '_tour_duration', array( 'type' => 'number', 'single' => true, 'show_in_rest' => true )); register_post_meta('individual_tour', '_tour_location', array( 'type' => 'string', 'single' => true, 'show_in_rest' => true )); register_post_meta('individual_tour', '_experience_journey', array( 'type' => 'number', 'single' => true, 'show_in_rest' => true )); register_post_meta('individual_tour', '_hero_image', array( 'type' => 'number', 'single' => true, 'show_in_rest' => true )); register_post_meta('individual_tour', '_tour_gallery', array( 'type' => 'array', 'single' => true, 'show_in_rest' => array( 'schema' => array( 'type' => 'array', 'items' => array('type' => 'number') ) ) )); register_post_meta('individual_tour', '_tour_faqs', array( 'type' => 'array', 'single' => true, 'show_in_rest' => array( 'schema' => array( 'type' => 'array', 'items' => array( 'type' => 'object', 'properties' => array( 'question' => array('type' => 'string'), 'answer' => array('type' => 'string') ) ) ) ) )); } add_action('init', 'register_tour_meta_fields');