Skip to content

Instantly share code, notes, and snippets.

@akther80
Created April 20, 2023 10:13
Show Gist options
  • Save akther80/5578ba5912badd65a54e5df167dbf409 to your computer and use it in GitHub Desktop.
Save akther80/5578ba5912badd65a54e5df167dbf409 to your computer and use it in GitHub Desktop.
MyTravel - display card
add_action( 'mytravel_car_rental_after_shop_loop_item', 'mytravel_child_single_car_rental_amenities', 5 );
add_filter( 'init', 'mytravel_remove_car_rental_footer_wrapper' );
function mytravel_remove_car_rental_footer_wrapper() {
remove_action( 'mytravel_car_rental_after_shop_loop_item', 'mytravel_car_rental_footer_wrapper', 5 );
}
if ( ! function_exists( 'mytravel_child_single_car_rental_amenities' ) ) {
/**
* Output single hotel amenities
*/
function mytravel_child_single_car_rental_amenities() {
if ( ! mytravel_is_acf_activated() ) {
return;
}
$group = get_field_object( 'amenities' );
$group_value = !empty( $group['value'] ) ? $group['value'] : array();
$luggage_capacity = get_field_object( 'luggage_capacity' );
$vehicle_amenities = mytravel_get_field( 'vehicle_amenities' );
?>
<div id="single-hotel__description" class="border-bottom py-4 position-relative mt-1 mb-4">
<?php
foreach ( $group['sub_fields'] as $key => $value ) :
if ( ! empty( $group_value ) ) :
$name = $value['name'];
?>
<div class="mb-2 d-flex">
<div class="text-gray-1 mr-2"><?php echo esc_html( $value['label'] ); ?>:</div>
<div class="text-primary"><?php echo esc_html( $group_value[$name] ); ?></div>
</div>
<?php
endif;
endforeach;
?>
</div>
<?php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment