Skip to content

Instantly share code, notes, and snippets.

@erip2
Created February 11, 2020 08:19
Show Gist options
  • Save erip2/07b70c995068bec368b10da37c14260d to your computer and use it in GitHub Desktop.
Save erip2/07b70c995068bec368b10da37c14260d to your computer and use it in GitHub Desktop.
<?php
/**
* The homepage template
* Template Name: HomePage
*
* @package private-holidays
*/
get_header();
?>
<div class="banner">
<h1><?php the_field('main_title') ?></h1>
<div class="filter-container">
<form class="book-form">
<?php echo do_shortcode( '[contact-form-7 id="45" title="Booking Form"]' ); ?>
</form>
</div>
</div>
<h2 class="container-title">Recent holiday locations</h2>
<div class="container locations-container">
<div class="row" id="locations">
<?php
$query = new WP_Query(array(
'post_type' => 'location',
'post_status' => 'publish'
));
while ($query->have_posts()) {
$query->the_post();
$post_id = get_the_ID(); ?>
<div class="col-12">
<div class="location-container">
<div class="img-container">
<img src="https://www.ahstatic.com/photos/9399_ho_00_p_1024x768.jpg" alt="">
</div>
<div class="details-container">
<h5 class="mb-1"><?php echo the_title() ?></h5>
<p class="mb-3"><?php echo wp_trim_words( get_the_content(), 20 ) ?></p>
<div class="stats mb-3">
<img class="mr-1 ml-2" src="./wp-content/themes/private-holidays/images/bed.svg" alt="">
<?php echo the_field('bedrooms') ?>
<img class="mr-1 ml-2" src="./wp-content/themes/private-holidays/images/bed.svg" alt="">
<?php echo the_field('showers') ?>
<?php if(get_field('beach')) { ?>
<img class="mr-1 ml-2" src="./wp-content/themes/private-holidays/images/beachfront.svg" alt="">
<?php } ?>
<?php if(get_field('pool')) { ?>
<img class="mr-1 ml-2" src="./wp-content/themes/private-holidays/images/pool.svg" alt="">
<?php } ?>
</div>
<a class="btn book-btn" href="<?php echo get_post_permalink() ?>">Book now</a>
</div>
</div>
</div>
<?php
}
wp_reset_query();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment