Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

[Don't Merge] PR #39 commits, pushed to a branch that can deploy to a Pantheon multidev environment #41

Closed
wants to merge 11 commits into from
2 changes: 2 additions & 0 deletions assets/css/adventure.css

Large diffs are not rendered by default.

452 changes: 452 additions & 0 deletions assets/html/product.html

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions comments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* Comments template.
*
* @package WPAMPTheme
*/

/*
* If the current post is protected by a password and
* the visitor has not yet entered the password we will
* return early without loading the comments.
*/
if ( post_password_required() ) {
return;
}

$reviews = wp_count_comments( get_the_ID() );
?>

<div class="product-reviews">

<h2 class="mb3"><?php esc_html_e( 'Reviews', 'travel' ); ?></h2>

<div class="comments wrap__item">

<?php $sort_attr = ( 'asc' === get_option( 'comment_order' ) ) ? ' sort="ascending" ' : ''; ?>
<amp-live-list id="amp-live-comments-list-<?php the_ID(); ?>" class="live-list" layout="container" <?php echo $sort_attr; // WPCS: XSS OK. ?> data-poll-interval="<?php echo esc_attr( AMP_TRAVEL_LIVE_LIST_POLL_INTERVAL ); ?>" data-max-items-per-page="<?php echo esc_attr( get_option( 'page_comments' ) ? get_option( 'comments_per_page' ) : 10000 ); ?>">
<ol items class="comments__list">
<?php
wp_list_comments( array(
'style' => 'ol',
'short_ping' => true,
) );
?>
</ol><!-- .comment-list -->
<div update class="live-list__button">
<button class="button" on="tap:amp-live-comments-list-<?php the_ID(); ?>.update"><?php esc_html_e( 'New review(s)', 'travel' ); ?></button>
</div>
<nav pagination>
<?php the_comments_navigation(); ?>
</nav>
</amp-live-list>

<?php if ( ! comments_open() ) : ?>
<p class="no-comments"><?php esc_html_e( 'Reviews are closed.', 'travel' ); ?></p>
<?php endif; ?>

<?php
// Warning: If you supply title_reply_before/title_reply_after here then the comment_form_defaults filter won't be able to inject the necessary markup for AMP.
comment_form();
?>

</div>

</div>
<!-- / product-reviews -->
81 changes: 81 additions & 0 deletions footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php
/**
* Theme footer template.
*
* @todo Create proper footer template(s).
* @package WPAMPTheme
*/

// Ignore the issues of this file since that's just a copied HTML placeholder.
// @codingStandardsIgnoreFile
?>
<!-- Footer -->
<footer class="travel-footer overflow-hidden">

<div class="relative bg-black">

<!-- Angle -->
<div class="travel-footer-angle-block absolute top-0 bottom-0 right-0 xs-hide sm-hide"></div>
<div class="travel-footer-angle absolute xs-hide sm-hide"></div>
<!--/ Angle -->

<!-- Right column -->
<div class="travel-newsletter-signup">
<header class="max-width-3 mx-auto px1 md-px2">
<h4 class="travel-footer-right-column-heading travel-spacing-none h2 mb3 blue">Want travel deals<br>straight to your inbox?</h4>
<div class="h4 bold mb1">Sign up to our newsletter</div>
</header>
<div class="relative">
<div class="travel-footer-input-bg bg-black absolute right-0 left-0 md-hide lg-hide"></div>
<div class="max-width-3 mx-auto px1 md-px2 relative">
<div class="travel-input-group flex items-center col-12 rounded travel-shadow">
<input class="travel-input travel-input-big block col-12 flex-auto rounded-left" type="text" name="email" placeholder="Enter your email">
<span class="travel-input-group-sep travel-border-gray relative z1 block"></span>
<button type="button" class="travel-link travel-input-big nowrap rounded-right">
Sign up now
</button>
</div>
</div>
</div>
</div>
<!--/ Right column -->

<!-- Left column -->
<div class="max-width-3 mx-auto px1 md-px2">
<div class="flex pt3 md-pt4 col-12 md-col-6 pr3">
<div class="col-2">
<a href="travel.amp" class="inline-block h2 line-height-1 circle white">
<svg class="travel-icon travel-icon-logo h2" viewBox="0 0 100 100"><g fill="none" fill-rule="evenodd" stroke="currentColor" stroke-width="7.5"><circle cx="50" cy="50" r="45"></circle><path d="M20.395 83.158c-2.37-10.263-.79-18.553 4.737-24.87 8.29-9.472 17.763-1.183 26.052-9.472 8.29-8.29 2.37-18.948 10.658-26.053 5.526-4.737 12.237-6.316 20.132-4.737M39.084 95c-2.788-10.2-1.912-17.304 2.627-21.316 6.808-6.017 14.956-.68 24.088-9.623 9.13-8.94 3.062-17.133 10.255-23.534 4.795-4.267 10.282-5.668 16.46-4.203"></path></g></svg> </a>
</div>
<div class="col-5">
<h4 class="travel-spacing-none mb2 h3 gray bold">Company</h4>
<div class="line-height-4 mb4">
<a href="#" class="travel-link block gray">About</a>
<a href="#" class="travel-link block gray">Careers</a>
<a href="#" class="travel-link block gray">Contact</a>
</div>
</div>
<div class="col-5">
<h4 class="travel-spacing-none mb2 h3 gray bold">Discover</h4>
<div class="line-height-4 mb4">
<a href="#" class="travel-link block gray">Activities</a>
<a href="#" class="travel-link block gray">Tours</a>
<a href="#" class="travel-link block gray">Experiences</a>
<a href="#" class="travel-link block gray">Featured Adventures</a>
<a href="#" class="travel-link block gray">Search</a>
</div>
</div>
</div>
<div class="py3 gray">
&copy; Copyright 2018
</div>
</div>
<!--/ Left column -->
</div>
</footer>
<!--/ Footer -->
<?php wp_footer(); ?>

</section>
</body>
</html>
45 changes: 45 additions & 0 deletions header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Theme header template.
*
* @todo Create proper header template(s).
* @package WPAMPTheme
*/

?>
<!doctype html>
<html amp <?php language_attributes(); ?>>
<head>
<?php wp_head(); ?>
<link rel="profile" href="http://gmpg.org/xfn/11">
</head>
<body <?php body_class(); ?>>

<amp-state id="search_query">
<script type="application/json">
{
"search": ""
}
</script>
</amp-state>

<?php
echo '<amp-state id="adventure_price"><script type="application/json">"' . esc_html( get_post_meta( get_the_ID(), 'amp_travel_price', true ) ) . '"</script></amp-state>
<amp-state id="adventure_current_price"><script type="application/json">"' . esc_html( get_post_meta( get_the_ID(), 'amp_travel_price', true ) ) . '"</script></amp-state>';
?>

<amp-state id="fields_query"><script type="application/json">""</script></amp-state>
<amp-state id="query_query"><script type="application/json">""</script></amp-state>

<section class="travel-main-wrapper overflow-hidden" role="main">

<!-- Results Navbar -->
<header class="travel-results-navbar pt4 pr4 pl4">
<div class="px1 md-px2 flex justify-between items-stretch">
<div class="flex items-stretch">
<a href="travel.amp" class="travel-results-navbar-icon h2 circle my1 md-my2">
<svg class="travel-icon travel-icon-logo h2" viewBox="0 0 100 100"><g fill="none" fill-rule="evenodd" stroke="currentColor" stroke-width="7.5"><circle cx="50" cy="50" r="45"></circle><path d="M20.395 83.158c-2.37-10.263-.79-18.553 4.737-24.87 8.29-9.472 17.763-1.183 26.052-9.472 8.29-8.29 2.37-18.948 10.658-26.053 5.526-4.737 12.237-6.316 20.132-4.737M39.084 95c-2.788-10.2-1.912-17.304 2.627-21.316 6.808-6.017 14.956-.68 24.088-9.623 9.13-8.94 3.062-17.133 10.255-23.534 4.795-4.267 10.282-5.668 16.46-4.203"></path></g></svg> </a>
</div>
</div>
</header>
<!--/ Results Navbar -->
75 changes: 1 addition & 74 deletions includes/class-amp-travel-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,80 +229,7 @@ public function render_block_travel_popular( $attributes ) {
return $output;
}

$output .= '<section class="travel-popular pb4 pt3 relative">';

if ( ! empty( $attributes['heading'] ) ) {
$output .= '<header class="max-width-3 mx-auto px1 md-px2">
<h3 class="h1 bold line-height-2 md-hide lg-hide" aria-hidden="true">' . esc_html( $attributes['heading'] ) . '</h3>
<h3 class="h1 bold line-height-2 xs-hide sm-hide center">' . esc_html( $attributes['heading'] ) . '</h3>
</header>';
}

$output .= '<div class="overflow-scroll">
<div class="travel-overflow-container">
<div class="flex px1 md-px2 mxn1">';

$popular_classes = array(
'travel-popular-tilt-right',
'travel-results-result',
'travel-popular-tilt-left',
);

foreach ( $adventures as $index => $adventure ) {
$attachment_id = get_post_thumbnail_id( $adventure->ID );
$img_src = wp_get_attachment_image_url( $attachment_id, 'full' );
$img_srcset = wp_get_attachment_image_srcset( $attachment_id );
$price = get_post_meta( $adventure->ID, 'amp_travel_price', true );
$rating = round( (int) get_post_meta( $adventure->ID, 'amp_travel_rating', true ) );
$comments = wp_count_comments( $adventure->ID );
$locations = wp_get_post_terms( $adventure->ID, 'location', array(
'fields' => 'names',
) );

if ( is_wp_error( $locations ) || empty( $locations ) ) {
$location = '--';
} else {
$location = $locations[0];
}

$output .= '<div class="m1 mt3 mb2"><div class="' . esc_html( $popular_classes[ $index ] ) . ' mb1">
<div class="relative travel-results-result">
<a class="travel-results-result-link block relative" href="' . esc_url( get_the_permalink( $adventure->ID ) ) . '">
<amp-img class="block rounded" width="346" height="200" noloading="" src="' . esc_url( $img_src ) . '" srcset="' . esc_attr( $img_srcset ) . '"></amp-img>
</a>
</div>
</div>
<div class="h2 line-height-2 mb1">
<span class="travel-results-result-text">' . esc_html( get_the_title( $adventure->ID ) ) . '</span>
<span class="travel-results-result-subtext h3">•</span>
<span class="travel-results-result-subtext h3">$&nbsp;</span><span class="black bold">' . esc_html( $price ) . '</span>
</div>
<div class="h4 line-height-2">
<div class="inline-block relative mr1 h3 line-height-2">
<div class="travel-results-result-stars green">';

for ( $i = 0; $i < $rating; $i++ ) {
$output .= '★';
}

$output .= '</div>
</div>
<span class="travel-results-result-subtext mr1">' .
/* translators: %d: The number of reviews */
sprintf( esc_html__( '%d Reviews', 'travel' ), esc_html( $comments->approved ) ) . '</span>
<span class="travel-results-result-subtext"><svg class="travel-icon" viewBox="0 0 77 100"><g fill="none" fill-rule="evenodd"><path stroke="currentColor" stroke-width="7.5" d="M38.794 93.248C58.264 67.825 68 49.692 68 38.848 68 22.365 54.57 9 38 9S8 22.364 8 38.85c0 10.842 9.735 28.975 29.206 54.398a1 1 0 0 0 1.588 0z"></path><circle cx="38" cy="39" r="10" fill="currentColor"></circle></g></svg>
' . esc_html( $location ) . '</span>
</div>
</div>';

}

$output .= '</div>
</div>
</div>
</section>';

return $output;
return amp_travel_get_popular_adventures( $adventures, $attributes );
}

/**
Expand Down
Loading