tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'menu-1' => esc_html__( 'Primary', 'travel-escape' ), '404-quick-links' => esc_html__( '404 Page Quick Links', 'travel-escape' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'travel_escape_custom_background_args', array( 'default-color' => '', 'default-image' => '', ) ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 250, 'width' => 250, 'flex-width' => true, 'flex-height' => true, ) ); } endif; add_action( 'after_setup_theme', 'travel_escape_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function travel_escape_content_width() { $GLOBALS['content_width'] = apply_filters( 'travel_escape_content_width', 640 ); // phpcs:ignore WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedVariableFound } add_action( 'after_setup_theme', 'travel_escape_content_width', 0 ); /** * Array recursive sanitization. * * @param array $array submitted $_POST data array. * @return mixed */ function travel_escape_sanitize( $array ) { foreach ( $array as $key => &$value ) { if ( is_array( $value ) ) { $value = travel_escape_sanitize( $value ); } else { $value = sanitize_text_field( wp_unslash( $value ) ); } } return $array; } /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function travel_escape_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'travel-escape' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'travel-escape' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Widget Area One', 'travel-escape' ), 'id' => 'footer-widget-1', 'description' => esc_html__( 'Add widgets here.', 'travel-escape' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Widget Area Two', 'travel-escape' ), 'id' => 'footer-widget-2', 'description' => esc_html__( 'Add widgets here.', 'travel-escape' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Widget Area Three', 'travel-escape' ), 'id' => 'footer-widget-3', 'description' => esc_html__( 'Add widgets here.', 'travel-escape' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Widget Area Four', 'travel-escape' ), 'id' => 'footer-widget-4', 'description' => esc_html__( 'Add widgets here.', 'travel-escape' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Widget Area Five', 'travel-escape' ), 'id' => 'footer-widget-5', 'description' => esc_html__( 'Add widgets here.', 'travel-escape' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'travel_escape_widgets_init' ); function travel_escape_font_loader() { $fonts = travel_escape_fonts(); $heading_fonts = travel_escape_get_theme_mod( 'heading_fonts' ); $content_fonts = travel_escape_get_theme_mod( 'content_fonts' ); $heading_font_name = isset( $fonts[ $heading_fonts ] ) ? $fonts[ $heading_fonts ] : 'Roboto'; $content_font_name = isset( $fonts[ $content_fonts ] ) ? $fonts[ $content_fonts ] : 'Roboto'; $heading_font_handle = "travel-escape-font-{$heading_font_name}"; $content_font_handle = "travel-escape-font-{$content_font_name}"; wp_enqueue_style( $heading_font_handle, "//fonts.googleapis.com/css?family={$heading_fonts}", array(), '1.0.0', 'all' ); /** * Don't load the same font again. */ if ( ! wp_style_is( $content_font_handle ) ) { wp_enqueue_style( $content_font_handle, "//fonts.googleapis.com/css?family={$content_fonts}", array(), '1.0.0', 'all' ); } } /** * Enqueue scripts and styles. */ function travel_escape_scripts() { $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.' : '.min.'; $deps = array(); if ( defined( 'WP_TRAVEL_VERSION' ) && function_exists( 'travel_escape_itinerary_get_page_id' ) && ( get_the_ID() === travel_escape_itinerary_get_page_id( 'wp-travel-dashboard' ) ) ) { if ( function_exists( 'travel_escape_itinerary_can_load_bundled_scripts' ) && travel_escape_itinerary_can_load_bundled_scripts() ) { $deps[] = 'wp-travel-frontend-bundle'; } else { $deps[] = 'wp-travel-frontend'; } } travel_escape_font_loader(); wp_enqueue_style( 'travel-escape-bootstrap', get_template_directory_uri() . '/assets/css/bootstrap' . $suffix . 'css', $deps, TRAVEL_ESCAPE_VERSION ); wp_enqueue_style( 'travel-escape-style', get_stylesheet_uri(), $deps, TRAVEL_ESCAPE_VERSION ); wp_style_add_data( 'travel-escape-style', 'rtl', 'replace' ); wp_enqueue_style( 'travel-escape-slick-style', get_template_directory_uri() . '/assets/css/slick.css', $deps, TRAVEL_ESCAPE_VERSION ); wp_enqueue_style( 'travel-escape-main-style', get_template_directory_uri() . '/assets/css/main.css', $deps, TRAVEL_ESCAPE_VERSION ); travel_escape_custom_dynamic_colors(); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'travel-escape-navigation', get_template_directory_uri() . '/assets/js/navigation' . $suffix . 'js', array(), TRAVEL_ESCAPE_VERSION, true ); wp_enqueue_script( 'travel-escape-bootstrap', get_template_directory_uri() . '/assets/js/bootstrap' . $suffix . 'js', array(), TRAVEL_ESCAPE_VERSION, true ); wp_enqueue_script( 'travel-escape-isotope', get_template_directory_uri() . '/assets/js/isotope.pkgd' . $suffix . 'js', array(), TRAVEL_ESCAPE_VERSION, true ); wp_enqueue_script( 'travel-escape-slick', get_template_directory_uri() . '/assets/js/slick' . $suffix . 'js', array(), TRAVEL_ESCAPE_VERSION, true ); wp_enqueue_script( 'travel-escape-custom-script', get_template_directory_uri() . '/assets/js/custom' . $suffix . 'js', array(), TRAVEL_ESCAPE_VERSION, true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'travel_escape_scripts' ); /** * Pagination function. */ function travel_escape_pagination() { global $wp_query; ?> esc_html( 'Cormorant Garamond' ), 'Caveat:400,700' => esc_html( 'Caveat' ), 'Dancing+Script:400,700' => esc_html( 'Dancing Script' ), 'Heebo:400,500,700,800' => esc_html( 'Heebo' ), 'Kelly+Slab' => esc_html( 'Kelly Slab' ), 'Lato:400,400i,700,700i' => esc_html( 'Lato' ), 'Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap' => esc_html( 'Roboto' ), 'Geo:400,400i|Great+Vibes|Lato:300,400,700&display=swap' => esc_html( 'Geo' ), 'Poppins:300,400,500,600,700,800,900&display=swap' => esc_html( 'Poppins' ), 'Montserrat:400,400i,500,500i,600,600i,700,700i,800,800i' => esc_html( 'Montserrat' ), 'Nunito+Sans:400,400i,600,600i,700,700i' => esc_html( 'Nunito Sans' ), 'Open+Sans:400,400i,600,600i,700,700i,800,800i' => esc_html( 'Open Sans' ), 'Oswald:400,500,600,700' => esc_html( 'Oswald' ), 'Pacifico' => esc_html( 'Pacifico' ), 'Playfair+Display:400,400i,700,700i' => esc_html( 'Playfair Display' ), 'Ubuntu:400,400i,500,500i,700,700i' => esc_html( 'Ubuntu' ), ); return apply_filters( 'travel_escape_fonts', $fonts ); } function travel_escape_social_links() { return apply_filters( 'travel_escape_social_links', array( 'facebook', 'twitter', 'instagram', ) ); } function travel_escape_get_social_link_url() { $link_url = array(); $travel_escape_social_links = travel_escape_social_links(); if ( is_array( $travel_escape_social_links ) && ! empty( $travel_escape_social_links ) ) { foreach ( $travel_escape_social_links as $social_link ) { $key = "social_link_{$social_link}"; $url = travel_escape_get_theme_mod( $key ); if ( $url ) { $link_url[ $social_link ] = $url; } } } return $link_url; } if ( ! function_exists( 'travel_escape_get_newsletter_form' ) ) { /** * Prints the newsletter form. * * @uses mc4wp_show_form() - MailChimp for WordPress plugin * @link https://www.mc4wp.com/ * * @param int $form_id Form id of mc4wp. * @param bool $echo Return or print the form html. */ function travel_escape_get_newsletter_form( $form_id = 0, $echo = true ) { if ( ! function_exists( 'mc4wp_show_form' ) ) { return; } ob_start(); try { mc4wp_show_form( $form_id, array(), true ); } catch ( Exception $e ) { echo ''; } $form = ob_get_clean(); if ( ' ' === $form || ! $form ) { return; } if ( ! $echo ) { return $form; } echo $form; // phpcs:ignore } } if ( ! function_exists( 'travel_escape_menu_fallback' ) ) { /** * If no navigation menu is assigned, this function will be used for the fallback. * * @see https://developer.wordpress.org/reference/functions/wp_nav_menu/ for available $args arguments. * @param mixed $args Menu arguments. * @return string $output Return or echo the add menu link. */ function travel_escape_menu_fallback( $args ) { if ( ! current_user_can( 'edit_theme_options' ) ) { return; } $link = $args['link_before']; $link .= '' . $args['before'] . esc_html__( 'Add a menu', 'travel-escape' ) . $args['after'] . ''; $link .= $args['link_after']; if ( false !== stripos( $args['items_wrap'], '%4$s', $args['container'], $args['container_class'], $args['container_id'], $output ); } if ( $args['echo'] ) { echo wp_kses_post( $output ); } return $output; } } function travel_escape_customizer_get_taxonomies() { if ( ! defined( 'WP_TRAVEL_VERSION' ) ) { return; } return array( 'travel_locations' => __( 'Trip Locations', 'travel-escape' ), 'itinerary_types' => __( 'Trip Types', 'travel-escape' ), 'category' => __( 'WP Category', 'travel-escape' ), ); } if ( ! function_exists( 'travel_escape_customizer_get_terms' ) ) { /** * This function returns the formated array of terms * for the given taxonomy name, for the customizer dropdown. * * @param string $tax_name Taxonomy name. Default is "category". * @param bool $hide_empty Takes boolean value, pass true if you want to hide empty terms. * @return array $items Formated array for the dropdown options for the customizer. */ function travel_escape_customizer_get_terms( $tax_name = 'category', $hide_empty = true ) { if ( empty( $tax_name ) ) { return; } $items = array(); $terms = get_terms( array( 'taxonomy' => $tax_name, 'hide_empty' => $hide_empty, ) ); if ( is_array( $terms ) && count( $terms ) > 0 ) { foreach ( $terms as $term ) { $term_name = ! empty( $term->name ) ? $term->name : false; $term_id = ! empty( $term->term_id ) ? $term->term_id : ''; if ( $term_name ) { $items[ $term_id ] = $term_name; } } } return $items; } } if ( ! function_exists( 'travel_escape_get_itinerary_meta' ) ) { /** * Returns the array of wp travel trips meta informations. * * @param array $args Arguments for wp travel meta datas. It accepts the following values: * * trip_id => WP Travel Trip ID, default is get_the_ID(). * * min_price_sale => If set to 0, it will return sale price for any pricing option. * * retrive => Type of meta that you want to receive, default is all. * > **Other accepted values are:** * > * all ( default ), * > * general, * > * prices, * > * date_and_time, * > * trip_terms, * > * thumbnails, * * featured_trips => If passed true, then function will returns * the meta info for featured trips only. * Default is false. * * @return array $wp_travel_meta Array of WP Travel meta data. */ function travel_escape_get_itinerary_meta( $args = array() ) { $wp_travel_meta = array(); /** * Bail early if WP Travel plugin is not activated or not exists. * Also here WP_Travel is a function name, not a class name. */ if ( ! function_exists( 'WP_Travel' ) ) { return $wp_travel_meta; } if ( ! class_exists( 'Travel_Escape_WP_Travel_Metas' ) ) { require_once get_template_directory() . '/inc/classes/class-travel-escape-wp-travel-metas.php'; } $default = array( 'trip_id' => get_the_ID(), 'min_price_sale' => 1, 'retrive' => 'all', 'featured_trips' => false, ); $args = wp_parse_args( $args, $default ); $trip_id = ! empty( $args['trip_id'] ) ? $args['trip_id'] : false; $min_price_sale = $args['min_price_sale']; $retrive = ! empty( $args['retrive'] ) ? $args['retrive'] : 'all'; $featured_trips = ! empty( $args['featured_trips'] ) ? $args['featured_trips'] : false; // Bail early if trip id is empty. if ( empty( $trip_id ) ) { return $wp_travel_meta; } // Bail early if provided post id is not WP Travel Itinerary post. if ( 'itineraries' !== get_post_type( $trip_id ) ) { return $wp_travel_meta; } $meta_object = new Travel_Escape_WP_Travel_Metas( $trip_id ); $general = $meta_object->general(); $prices = $meta_object->prices( $min_price_sale ); $date_and_time = $meta_object->date_and_time(); $trip_terms = $meta_object->trip_terms(); $thumbnails = $meta_object->thumbnails(); /** * Create the meta array. */ $itinerary_meta = array( 'general' => $general, 'prices' => $prices, 'date_and_time' => $date_and_time, 'trip_terms' => $trip_terms, 'thumbnails' => $thumbnails, ); $wp_travel_meta = $itinerary_meta; /** * If $args['featured_trips'] is passed true then * reset the array and list only featured trips. */ if ( $featured_trips && 'yes' === $itinerary_meta['general']['is_featured'] ) { $wp_travel_meta = array(); $wp_travel_meta = $itinerary_meta; } if ( 'all' === $retrive ) { return $wp_travel_meta; } return ! empty( $wp_travel_meta[ $retrive ] ) ? $wp_travel_meta[ $retrive ] : array(); } } function travel_escape_custom_dynamic_colors() { $primary_color = sanitize_hex_color( travel_escape_get_theme_mod( 'primary_color' ) ); $secondary_color = sanitize_hex_color( travel_escape_get_theme_mod( 'secondary_color' ) ); $fonts = travel_escape_fonts(); $heading_fonts = travel_escape_get_theme_mod( 'heading_fonts' ); $heading_font_name = isset( $fonts[ $heading_fonts ] ) ? $fonts[ $heading_fonts ] : 'Roboto'; ob_start(); ?> ', '' ), '', $data ); wp_add_inline_style( 'travel-escape-main-style', $data ); } /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/itinerary-helpers.php'; /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Functions which enhance the theme by hooking into WordPress. */ require get_template_directory() . '/inc/template-functions.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ if ( defined( 'JETPACK__VERSION' ) ) { require get_template_directory() . '/inc/jetpack.php'; } /** * TGM plugin additions. */ require get_template_directory() . '/inc/tgm-plugin/tgmpa-hook.php'; /** * Load elementor widgets. */ require get_template_directory() . '/inc/elementor/class-travel-escape-load-elementor-widgets.php';