Skip to content

Instantly share code, notes, and snippets.

@akther80
Created April 7, 2023 05:30
Show Gist options
  • Save akther80/c55b5523e8372c2f1a90373c78137592 to your computer and use it in GitHub Desktop.
Save akther80/c55b5523e8372c2f1a90373c78137592 to your computer and use it in GitHub Desktop.
MyTravel - Change H5 as H2 in tour subtitles
if ( ! function_exists( 'mytravel_single_tour_itinerary' ) ) {
/**
* Output of single tour itinerary
*/
function mytravel_single_tour_itinerary() {
if ( ! mytravel_is_acf_activated() ) {
return;
}
$tour_itinerary = mytravel_get_field( 'itinerary_places' );
$should_display = false;
if ( is_array( $tour_itinerary ) ) {
foreach ( $tour_itinerary as $key => $itinerary ) {
if ( ! empty( $itinerary ) ) {
$should_display = true;
break;
}
}
}
if ( $tour_itinerary && $should_display ) {
?>
<div id="itinerary" class="border-bottom py-4">
<h2 class="font-size-21 font-weight-bold text-dark mb-4">
<?php
esc_html_e( 'Itinerary', 'mytravel' );
?>
</h2>
<div id="basicsAccordion1">
<?php
$index = 0;
foreach ( $tour_itinerary as $key => $itinerary ) :
if ( empty( $itinerary ) ) {
continue;
}
// $field = get_field_object( 'itinerary_' . $key );
$tab_count = $index + 1;
?>
<!-- Card -->
<div class="card border-0 mb-3">
<div class="card-header border-bottom-0 p-0" id="heading-<?php echo esc_attr( $tab_count ); ?>">
<h5 class="mb-0">
<?php if ( ! empty( $itinerary['label'] ) || ! empty( $itinerary['title'] ) ) : ?>
<a role="button" href="#" class="collapse-link btn btn-link btn-block d-flex align-items-md-center font-weight-bold p-0" data-toggle="collapse" data-target="#collapse-<?php echo esc_attr( $tab_count ); ?>" aria-expanded="<?php echo esc_attr( 0 === $index ) ? 'true' : 'false'; ?>" aria-controls="collapse-<?php echo esc_attr( $tab_count ); ?>">
<span class="d-inline-block text-primary font-size-22 mb-3 mb-md-0 mr-3">
<i class="far fa-circle"></i>
</span>
<?php if ( ! empty( $itinerary['label'] ) ) : ?>
<span class="d-inline-block text-primary flex-shrink-0">
<?php
echo esc_html( $itinerary['label'] );
?>
<span class="px-2">-</span>
</span>
<?php endif ?>
<?php if ( ! empty( $itinerary['title'] ) ) : ?>
<span class="d-inline-block h6 font-weight-bold text-gray-3 text-left mb-0"><?php echo esc_html( $itinerary['title'] ); ?></span>
<?php endif ?>
</a>
<?php endif ?>
</h5>
</div>
<div id="collapse-<?php echo esc_attr( $tab_count ); ?>" class="collapse
<?php
if ( 1 === $tab_count ) :
?>
show<?php endif; ?>" aria-labelledby="heading-<?php echo esc_attr( $tab_count ); ?>" data-parent="#basicsAccordion1">
<div class="card-body pl-6 pb-0 pt-0">
<?php if ( ! empty( $itinerary['description'] ) ) : ?>
<p class="mb-0">
<?php echo esc_html( $itinerary['description'] ); ?>
</p>
<?php endif ?>
</div>
</div>
</div>
<!-- End Card -->
<?php
$index++;
endforeach;
?>
</div>
</div>
<?php
}
}
}
if ( ! function_exists( 'mytravel_single_tour_faq' ) ) {
/**
* Ouput of single tour FAQ
*/
function mytravel_single_tour_faq() {
if ( ! mytravel_is_acf_activated() ) {
return;
}
$group = mytravel_get_field( 'faq_tour' );
$should_display = false;
if ( is_array( $group ) ) {
foreach ( $group as $key => $faq ) {
if ( ! empty( $faq ) ) {
$should_display = true;
break;
}
}
}
if ( is_array( $group ) && $should_display ) {
?>
<div id="faq" class="border-bottom py-4">
<h2 class="font-size-21 font-weight-bold text-dark mb-4">
<?php
esc_html_e( 'Faq', 'mytravel' );
?>
</h2>
<div id="faqAccordion1">
<?php
$index = 0;
foreach ( $group as $key => $faq ) :
if ( empty( $faq ) ) {
continue;
}
// $field = get_field_object( 'faq_' . $key );
$tab_count = $index + 1;
?>
<!-- Card -->
<?php if ( ! empty( $faq['title'] ) || ! empty( $faq['description'] ) ) : ?>
<div class="card border-0 mb-3">
<div class="card-header border-bottom-0 p-0" id="faq-heading-<?php echo esc_attr( $tab_count ); ?>">
<h5 class="mb-0">
<a role="button" class="collapse-link btn btn-link btn-block d-flex align-items-md-center p-0" href="#" data-toggle="collapse" data-target="#faq-collapse-<?php echo esc_attr( $tab_count ); ?>" aria-expanded="<?php echo esc_attr( 0 === $index ) ? 'true' : 'false'; ?>" aria-controls="faq-collapse-<?php echo esc_attr( $tab_count ); ?>">
<span class="d-inline-block border border-color-8 rounded-xs border-width-2 p-2 mb-3 mb-md-0 mr-4">
<span class="minus" style="">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16px" height="2px" class="injected-svg js-svg-injector mb-0" data-parent="#rectangle"><path fill-rule="evenodd" fill="rgb(59, 68, 79)" d="M-0.000,-0.000 L15.000,-0.000 L15.000,2.000 L-0.000,2.000 L-0.000,-0.000 Z"></path></svg>
</span>
<span class="plus" style="">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16px" height="16px" class="injected-svg js-svg-injector mb-0" data-parent="#plus1"><path fill-rule="evenodd" fill="rgb(59, 68, 79)" d="M16.000,9.000 L9.000,9.000 L9.000,16.000 L7.000,16.000 L7.000,9.000 L-0.000,9.000 L-0.000,7.000 L7.000,7.000 L7.000,-0.000 L9.000,-0.000 L9.000,7.000 L16.000,7.000 L16.000,9.000 Z"></path></svg>
</span>
</span>
<?php if ( ! empty( $faq['title'] ) ) : ?>
<span class="h6 font-weight-bold text-gray-3 mb-0"><?php echo esc_html( $faq['title'] ); ?></span>
<?php endif; ?>
</a>
</h5>
</div>
<div id="faq-collapse-<?php echo esc_attr( $tab_count ); ?>" class="collapse
<?php
if ( 1 === $tab_count ) :
?>
show<?php endif; ?>" aria-labelledby="faq-heading-<?php echo esc_attr( $tab_count ); ?>" data-parent="#faqAccordion1">
<div class="card-body pl-10 pl-md-10 pr-md-12 pt-0">
<?php if ( ! empty( $faq['description'] ) ) : ?>
<p class="mb-0 text-gray-1 text-lh-lg">
<?php echo esc_html( $faq['description'] ); ?>
</p>
<?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>
<!-- End Card -->
<?php
$index++;
endforeach;
?>
</div>
</div>
<?php
}
}
}
if ( ! function_exists( 'mytravel_single_hotel_location_map' ) ) {
/**
* Output single hotel location map
*/
function mytravel_single_hotel_location_map() {
if ( ! mytravel_is_acf_activated() ) {
return;
}
$location = mytravel_get_field( 'location_map' );
if ( $location ) :
?>
<div id="map" class="position-relative border-bottom pt-4 pb-5">
<h2 class="font-size-21 font-weight-bold text-dark mb-4"><?php echo esc_html__( 'Location', 'mytravel' ); ?></h2>
<div class="acf-map" data-zoom="14" style="width: 100%; height: 480px;">
<div class="marker" data-lat="<?php echo esc_attr( $location['lat'] ); ?>" data-lng="<?php echo esc_attr( $location['lng'] ); ?>"></div>
</div>
</div>
<?php
endif;
}
}
if ( ! function_exists( 'mytravel_single_hotel_description' ) ) {
/**
* Output single hotel description
*/
function mytravel_single_hotel_description() {
$product_format = mytravel_get_product_format();
$title_class = '';
if ( 'hotel' !== $product_format ) {
$title_class = ' mb-3';
}
?>
<div id="description" class="border-bottom position-relative">
<h2 id="scroll-description" class="font-size-21 font-weight-bold text-dark
<?php echo esc_attr( $title_class ); ?>">
<?php
echo esc_html__( 'Description', 'mytravel' );
?>
</h2>
<div class="description">
<?php
the_content();
?>
</div>
</div>
<?php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment