Add viator-collector plugin (Hop On Hop Off front-end reskin)

Consolidate the plugin into the TourWebsite repository (its separate
nested git repo has been removed). Includes the full new-design reskin:
scoped design stylesheet, SVG icon sprite, rebuilt listing/single/section
templates, and homepage hero/FAQ/testimonials shortcodes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4hNL1PSHxXbu94SCenpKj
This commit is contained in:
2026-09-12 21:11:20 +03:30
parent 99e5413fee
commit 7ada8860f8
42 changed files with 9019 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
<?php
/**
* Tour card — "Hop On Hop Off" design.
*
* Args:
* $post_id int Tour post ID (defaults to the loop post).
* $variant string 'wide' → listing item (<li class="titem">),
* 'rail' → homepage rail card (<li class="dcard">).
*
* Markup mirrors the .dcard rules in assets/css/vc-design.css (ported from
* new front/tours.html and index.html).
*/
defined( 'ABSPATH' ) || exit;
$post_id = isset( $post_id ) ? absint( $post_id ) : get_the_ID();
if ( ! $post_id ) {
return;
}
$variant = isset( $variant ) ? $variant : 'wide';
$permalink = get_permalink( $post_id );
$title = get_the_title( $post_id );
$price = get_post_meta( $post_id, '_vc_price_from', true );
$currency = get_post_meta( $post_id, '_vc_currency', true );
$rating = get_post_meta( $post_id, '_vc_rating', true );
$duration = get_post_meta( $post_id, '_vc_duration_text', true );
$minutes = absint( get_post_meta( $post_id, '_vc_duration_minutes', true ) );
if ( '' === (string) $duration && $minutes ) {
$duration = vc_duration_human( $minutes );
}
$excerpt = has_excerpt( $post_id )
? get_the_excerpt( $post_id )
: wp_trim_words( wp_strip_all_tags( (string) get_post_field( 'post_content', $post_id ) ), 22 );
$rating_html = '';
if ( '' !== (string) $rating ) {
$rating_html = '<span class="rating">' . vc_icon( 'star', 'icon--12 rating__star' )
. '<b>' . esc_html( number_format_i18n( (float) $rating, 1 ) ) . '</b><i>/5</i></span>';
}
$img_html = vc_tour_image_html( $post_id, 'dcard__img' );
$title_link = '<a href="' . esc_url( $permalink ) . '">' . esc_html( $title ) . '</a>';
ob_start();
?>
<div class="dcard__meta">
<?php if ( '' !== (string) $price ) : ?>
<div class="meta">
<span class="meta__k"><?php echo esc_html__( 'Start at', 'viator-collector' ); ?></span>
<span class="meta__v"><?php echo esc_html( vc_money( $price, $currency ) ); ?></span>
</div>
<?php endif; ?>
<?php if ( $duration ) : ?>
<div class="meta">
<span class="meta__k"><?php echo esc_html__( 'Duration', 'viator-collector' ); ?></span>
<span class="meta__v"><?php echo esc_html( $duration ); ?></span>
</div>
<?php endif; ?>
<?php echo vc_ring_badge( 'BOOK NOW · BOOK NOW · ', $permalink, 'card' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
<?php
$meta_html = ob_get_clean();
if ( 'rail' === $variant ) :
?>
<li class="dcard">
<?php echo $img_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php echo $rating_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php if ( $excerpt ) : ?>
<div class="dcard__desc">
<span class="dcard__desc-k"><?php echo esc_html__( 'Tour Description', 'viator-collector' ); ?></span>
<p><?php echo esc_html( $excerpt ); ?></p>
</div>
<?php endif; ?>
<div class="dcard__body">
<h3 class="dcard__title"><?php echo $title_link; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></h3>
<?php echo $meta_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
</li>
<?php
else :
?>
<li class="titem">
<article class="dcard dcard--wide">
<?php echo $img_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php echo $rating_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<div class="dcard__body">
<h2 class="dcard__title"><?php echo $title_link; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></h2>
<?php echo $meta_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
</article>
<?php if ( $excerpt ) : ?>
<p class="titem__desc"><?php echo esc_html( $excerpt ); ?></p>
<?php endif; ?>
</li>
<?php
endif;