%4$s'; $on = __( 'Updated on ', 'travel-booking' ); }else{ $time_string = ''; } }else{ $time_string = ''; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); $posted_on = sprintf( '%1$s %2$s', ' '. esc_html( $on ) .'', '' . $time_string . '' ); echo ''. $posted_on .''; } endif; if( ! function_exists( 'travel_booking_posted_by' ) ) : /** * Posted By */ function travel_booking_posted_by(){ echo ''; } endif; if( ! function_exists( 'travel_booking_categories' ) ) : /** * Blog Categories */ function travel_booking_categories(){ // Hide category and tag text for pages. if ( 'post' === get_post_type() ) { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( esc_html__( ' ', 'travel-booking' ) ); if ( $categories_list ) { echo wp_kses_post( $categories_list ); } } } endif; if( ! function_exists( 'travel_booking_tags' ) ) : /** * Blog Categories */ function travel_booking_tags(){ // Hide category and tag text for pages. if ( 'post' === get_post_type() ) { /* translators: used between list items, there is a space */ $tags_list = get_the_tag_list( '', esc_html_x( ' ', 'list item separator', 'travel-booking' ) ); if ( $tags_list ) { /* translators: 1: list of tags. */ printf( '
' . $tags_list . '
' ); // WPCS: XSS OK. } } } endif; if ( ! function_exists( 'travel_booking_comment_count' ) ) : /** * Comments counts */ function travel_booking_comment_count(){ if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( sprintf( wp_kses( /* translators: %s: post title */ __( 'Leave a Comment on %s', 'travel-booking' ), array( 'span' => array( 'class' => array(), ), ) ), get_the_title() ), '1', '%' ); echo ''; } } endif; if( ! function_exists( 'travel_booking_sidebar_layout' ) ) : /** * Return sidebar layouts for pages */ function travel_booking_sidebar_layout(){ global $post; $return = false; // Default sidebar layout $default_layout = get_theme_mod( 'default_sidebar_layout', 'right-sidebar' ); if( is_singular( 'trip' ) ){ $wpte_option_setting = get_option('wp_travel_engine_settings', array() ); $hide_sidebar = false; if( ! empty( $wpte_option_setting ) && isset( $wpte_option_setting['booking'] ) ) $hide_sidebar = true; if( is_active_sidebar( 'wte-sidebar-id' ) || false == $hide_sidebar ){ if( $default_layout == 'left-sidebar' ){ $return = 'leftsidebar'; }elseif( $default_layout == 'right-sidebar' ){ $return = 'rightsidebar'; }else{ $return = 'fullwidth'; } }else{ $return = 'fullwidth'; } }elseif( is_singular( 'product' ) ){ if( is_active_sidebar( 'shop-sidebar' ) ){ if( $default_layout == 'left-sidebar' ){ $return = 'leftsidebar'; }elseif( $default_layout == 'right-sidebar' ){ $return = 'rightsidebar'; }else{ $return = 'fullwidth'; } }else{ $return = 'fullwidth'; } }elseif( is_page() ){ $page_layout = get_theme_mod( 'page_sidebar_layout', 'right-sidebar' ); $sidebar_layout = get_post_meta( $post->ID, '_tb_sidebar_layout', true ); $sidebar_layout = ! empty( $sidebar_layout ) ? $sidebar_layout : 'default-sidebar'; if( is_active_sidebar( 'sidebar' ) ){ if( $sidebar_layout == 'no-sidebar' ){ $return = 'fullwidth'; }elseif( ( $sidebar_layout == 'default-sidebar' && $page_layout == 'right-sidebar' ) || ( $sidebar_layout == 'right-sidebar' ) ){ $return = 'rightsidebar'; }elseif( ( $sidebar_layout == 'default-sidebar' && $page_layout == 'left-sidebar' ) || ( $sidebar_layout == 'left-sidebar' ) ){ $return = 'leftsidebar'; }elseif( $sidebar_layout == 'default-sidebar' && $page_layout == 'no-sidebar' ){ $return = 'fullwidth'; } }else{ $return = 'fullwidth'; } }elseif( is_single() ){ $post_layout = get_theme_mod( 'post_sidebar_layout', 'right-sidebar' ); $sidebar_layout = get_post_meta( $post->ID, '_tb_sidebar_layout', true ); $sidebar_layout = ! empty( $sidebar_layout ) ? $sidebar_layout : 'default-sidebar'; if( is_active_sidebar( 'sidebar' ) ){ if( $sidebar_layout == 'no-sidebar' ){ $return = 'fullwidth'; }elseif( ( $sidebar_layout == 'default-sidebar' && $post_layout == 'right-sidebar' ) || ( $sidebar_layout == 'right-sidebar' ) ){ $return = 'rightsidebar'; }elseif( ( $sidebar_layout == 'default-sidebar' && $post_layout == 'left-sidebar' ) || ( $sidebar_layout == 'left-sidebar' ) ){ $return = 'leftsidebar'; }elseif( $sidebar_layout == 'default-sidebar' && $post_layout == 'no-sidebar' ){ $return = 'fullwidth'; } }else{ $return = 'fullwidth'; } }elseif( ! is_active_sidebar( 'sidebar' ) && ! is_singular( 'trip' ) ){ $return = 'fullwidth'; }elseif( is_post_type_archive( 'trip' ) ){ $return = 'fullwidth'; }elseif( travel_booking_is_woocommerce_activated() && is_post_type_archive( 'product' ) ){ if( is_active_sidebar( 'shop-sidebar' ) ){ if( $default_layout == 'right-sidebar' ){ $return = 'rightsidebar'; }elseif ( $default_layout == 'left-sidebar' ) { $return = 'leftsidebar'; }else{ $return = 'fullwidth'; } }else{ $return = 'fullwidth'; } }elseif( is_404() ){ $return = ''; }else{ if( is_active_sidebar( 'sidebar' ) ){ if( $default_layout == 'right-sidebar' ){ $return = 'rightsidebar'; }elseif ( $default_layout == 'left-sidebar' ) { $return = 'leftsidebar'; }else{ $return = 'fullwidth'; } } else{ $return = 'fullwidth'; } } return $return; } endif; if( ! function_exists( 'travel_booking_comment_list' ) ) : /** * Callback function for Comment List * * @link https://codex.wordpress.org/Function_Reference/wp_list_comments */ function travel_booking_comment_list( $comment, $args, $depth ) { if ( 'div' === $args['style'] ) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = 'div-comment'; } ?> < id="comment-">
wp_travel_engine_currencies_symbol( $code ); } return $currency; } endif; if( ! function_exists( 'travel_booking_get_template_part' ) ) : /** * Get template from plus, companion or theme. * * @param string $template Name of the section. */ function travel_booking_get_template_part( $template ) { if( locate_template( $template . '.php' ) ){ get_template_part( $template ); }else{ if( defined( 'TBT_PLUGIN_DIR' ) ){ if( file_exists( TBT_PLUGIN_DIR . 'public/sections/' . $template . '.php' ) ){ require_once( TBT_PLUGIN_DIR . 'public/sections/' . $template . '.php' ); } } } } endif; if( ! function_exists( 'travel_booking_primary_menu_fallback' ) ) : /** * Fallback for primary menu */ function travel_booking_primary_menu_fallback(){ if( current_user_can( 'manage_options' ) ){ echo ''; } } endif; if( ! function_exists( 'travel_booking_get_homepage_section' ) ) : /** * Return homepage sections */ function travel_booking_get_homepage_section(){ $sections = array(); $ed_popular = get_theme_mod( 'ed_popular_section', true ); $ed_feature = get_theme_mod( 'ed_feature_section', true ); $ed_deal = get_theme_mod( 'ed_deal_section', true ); $ed_destination = get_theme_mod( 'ed_destination_section', true ); $ed_activities = get_theme_mod( 'ed_activities_section', true ); $ed_blog = get_theme_mod( 'ed_blog_section', true ); if( is_active_sidebar( 'about' ) ) array_push( $sections, 'sections/about' ); if( $ed_popular ) array_push( $sections, 'popular' ); if( is_active_sidebar( 'cta-one' ) ) array_push( $sections, 'sections/cta-one' ); if( $ed_feature ) array_push( $sections, 'featured-trip' ); if( $ed_deal )array_push( $sections, 'deals' ); if( $ed_destination )array_push( $sections, 'destination' ); if( is_active_sidebar( 'cta-two' ) ) array_push( $sections, 'sections/cta-two' ); if( $ed_activities )array_push( $sections, 'activities' ); if( $ed_blog ) array_push( $sections, 'sections/blog' ); return $sections; } endif; if( ! function_exists( 'travel_booking_get_header_search' ) ) : /** * Display search button in header */ function travel_booking_get_header_search(){ ?>
'page', 'fields' => 'ids', 'nopaging' => true, 'meta_key' => '_wp_page_template', 'meta_value' => $template_name ); return $pages = get_posts( $args ); } endif; /** * Check if Wp Travel Engine Companion Plugin is activated */ function travel_booking_is_tbt_activated() { return class_exists( 'Travel_Booking_Toolkit' ) ? true : false; } /** * Check if Wp Travel Engine Plugin is installed */ function travel_booking_is_wpte_activated(){ return class_exists( 'Wp_Travel_Engine' ) ? true : false; } /** * Query WooCommerce activation */ function travel_booking_is_woocommerce_activated() { return class_exists( 'woocommerce' ) ? true : false; } /** * Fuction to list Custom Post Type */ function travel_booking_get_posts( $post_type = 'post' ){ $args = array( 'posts_per_page' => -1, 'post_type' => $post_type, 'post_status' => 'publish', //'suppress_filters' => true ); $posts_array = get_posts( $args ); // Initate an empty array $post_options = array(); $post_options[''] = __( ' -- Choose -- ', 'travel-booking' ); if ( ! empty( $posts_array ) ) { foreach ( $posts_array as $posts ) { $post_options[ $posts->ID ] = esc_html( strip_tags( $posts->post_title ) ); } } return $post_options; wp_reset_postdata(); } if( ! function_exists( 'travel_booking_get_svg' ) ) : /** * Return SVG markup. * * @param array $args { * Parameters needed to display an SVG. * * @type string $icon Required SVG icon filename. * @type string $title Optional SVG title. * @type string $desc Optional SVG description. * } * @return string SVG markup. */ function travel_booking_get_svg( $args = array() ) { // Make sure $args are an array. if ( empty( $args ) ) { return __( 'Please define default parameters in the form of an array.', 'travel-booking' ); } // Define an icon. if ( false === array_key_exists( 'icon', $args ) ) { return __( 'Please define an SVG icon filename.', 'travel-booking' ); } // Set defaults. $defaults = array( 'icon' => '', 'title' => '', 'desc' => '', 'fallback' => false, ); // Parse args. $args = wp_parse_args( $args, $defaults ); // Set aria hidden. $aria_hidden = ' aria-hidden="true"'; // Set ARIA. $aria_labelledby = ''; /* * Restaurant and Cafe Pro doesn't use the SVG title or description attributes; non-decorative icons are described with .screen-reader-text. * * However, child themes can use the title and description to add information to non-decorative SVG icons to improve accessibility. * * Example 1 with title: 'arrow-right', 'title' => __( 'This is the title', 'textdomain' ) ) ); ?> * * Example 2 with title and description: 'arrow-right', 'title' => __( 'This is the title', 'textdomain' ), 'desc' => __( 'This is the description', 'textdomain' ) ) ); ?> * * See https://www.paciellogroup.com/blog/2013/12/using-aria-enhance-svg-accessibility/. */ if ( $args['title'] ) { $aria_hidden = ''; $unique_id = uniqid(); $aria_labelledby = ' aria-labelledby="title-' . $unique_id . '"'; if ( $args['desc'] ) { $aria_labelledby = ' aria-labelledby="title-' . $unique_id . ' desc-' . $unique_id . '"'; } } // Begin SVG markup. $svg = ''; // Display the title. if ( $args['title'] ) { $svg .= '' . esc_html( $args['title'] ) . ''; // Display the desc only if the title is already set. if ( $args['desc'] ) { $svg .= '' . esc_html( $args['desc'] ) . ''; } } /* * Display the icon. * * The whitespace around `` is intentional - it is a work around to a keyboard navigation bug in Safari 10. * * See https://core.trac.wordpress.org/ticket/38387. */ $svg .= ' '; // Add some markup to use as a fallback for browsers that do not support SVGs. if ( $args['fallback'] ) { $svg .= ''; } $svg .= ''; return $svg; } endif; if( ! function_exists( 'travel_booking_escape_text_tags' ) ) : /** * Remove new line tags from string * * @param $text * * @return string */ function travel_booking_escape_text_tags( $text ) { return (string) str_replace( array( "\r", "\n" ), '', strip_tags( $text ) ); } endif; if( ! function_exists( 'travel_booking_fallback_image' ) ) : /** * Returns fallback image */ function travel_booking_fallback_image( $image_size ){ $placeholder_src = get_template_directory_uri() . '/images/' . $image_size . '.jpg'; ?> <?php the_title_attribute(); ?>