'nepal', 'orderby' => 'price' ) ) as $tour ) { … } * * @param array $args destination, activity, category, tours (web address names), limit (1–48), * orderby (default|price|duration|rating|title|next_departure), order (asc|desc). * @return list> Empty when not connected or the site can't be reached. */ function tourtify_get_tours( array $args = array() ) { $tours = Tourtify_Render::tour_list( Tourtify_Render::tour_args( $args + array( 'limit' => 48 ) ) ); return is_wp_error( $tours ) ? array() : $tours; } } if ( ! function_exists( 'tourtify_get_tour' ) ) { /** * One published tour by its web address name, or null. * * @param string $slug The tour's web address name. * @return array|null */ function tourtify_get_tour( $slug ) { $tours = tourtify_get_tours( array( 'tours' => array( (string) $slug ) ) ); return $tours ? $tours[0] : null; } } if ( ! function_exists( 'tourtify_book_button' ) ) { /** * A Book now button that opens the tour's booking window (and loads the booking script on this page). * * Example: echo tourtify_book_button( 'everest-base-camp-trek', array( 'label' => 'Check dates' ) ); * * @param string $slug The tour's web address name. * @param array $args label (button text), title (the booking window's title). * @return string HTML, escaped. */ function tourtify_book_button( $slug, array $args = array() ) { return Tourtify_Render::button( sanitize_title( (string) $slug ), (string) ( $args['title'] ?? '' ), '', (string) ( $args['label'] ?? '' ) ); } } if ( ! function_exists( 'tourtify_tours' ) ) { /** * Tour cards, exactly as the Tourtify tours block renders them. * * @param array $args The [tourtify_tours] shortcode's attributes. * @return string HTML, escaped. */ function tourtify_tours( array $args = array() ) { return Tourtify_Render::tours( $args ); } }