feat: one breadcrumb, same place and style on every inner page
- Plugin: vc_breadcrumb_trail()/vc_breadcrumb_html(); tours, region, city and tag pages show Home / (Region) / Page in the banner instead of the generic 'Tour & Travel' label; the tour page uses the same helper - Theme: blog list shows Home / Blog; blog post title, breadcrumb and meta move into the banner like the other pages - Shared style: title's colour (white in photo banners, black on About), softer links, current page bold and shortened if long - also on phones - Plugin 1.9.6, theme 1.0.16 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -87,7 +87,12 @@ $vc_hero_img = vc_hero_image_source();
|
||||
</div>
|
||||
|
||||
<div class="container hero__content">
|
||||
<p class="pill hero__eyebrow"><?php echo esc_html__( 'Tour & Travel', 'viator-collector' ); ?></p>
|
||||
<?php
|
||||
// Short current-page label: "Tours" on the archive, the page's own
|
||||
// title on a page hosting [viator_listing], else the heading.
|
||||
$vc_crumb_current = ! empty( $vc_crumb_label ) ? $vc_crumb_label : ( is_page() ? get_the_title() : $vc_title );
|
||||
echo vc_breadcrumb_html( vc_breadcrumb_trail(), $vc_crumb_current ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
?>
|
||||
<h1 class="hero__title"><?php echo esc_html( $vc_title ); ?></h1>
|
||||
|
||||
<form class="filters" id="vc-filter-form" method="get" action="<?php echo esc_url( $vc_action ); ?>" novalidate>
|
||||
|
||||
@@ -38,37 +38,13 @@ while ( have_posts() ) :
|
||||
$lead = has_post_thumbnail( $post_id ) ? (string) get_the_post_thumbnail_url( $post_id, 'large' ) : $primary;
|
||||
$all = array_values( array_unique( array_filter( array_merge( array( $lead, $primary ), $gallery ) ) ) );
|
||||
|
||||
// Breadcrumb: Home › Region › City › Tour (the tour's canonical city).
|
||||
$crumbs = array( array( __( 'Home', 'viator-collector' ), home_url( '/' ) ) );
|
||||
$city_slug = class_exists( 'VC_Routing' ) ? VC_Routing::product_city( $post_id ) : '';
|
||||
$city = $city_slug ? get_term_by( 'slug', $city_slug, 'viator_destination' ) : null;
|
||||
if ( ! $city && $dest_terms && ! is_wp_error( $dest_terms ) ) {
|
||||
$city = $dest_terms[0];
|
||||
}
|
||||
if ( $city && $city->parent ) {
|
||||
$region = get_term( $city->parent, 'viator_destination' );
|
||||
if ( $region instanceof WP_Term && ! is_wp_error( get_term_link( $region ) ) ) {
|
||||
$crumbs[] = array( $region->name, get_term_link( $region ) );
|
||||
}
|
||||
}
|
||||
if ( $city && ! is_wp_error( get_term_link( $city ) ) ) {
|
||||
$crumbs[] = array( $city->name, get_term_link( $city ) );
|
||||
}
|
||||
|
||||
$book_href = $booking_url ? $booking_url : '#';
|
||||
$book_attrs = $booking_url ? ' target="_blank" rel="nofollow noopener"' : '';
|
||||
?>
|
||||
<div class="vc-app vc-single">
|
||||
<section class="section tour tour--top">
|
||||
<div class="container">
|
||||
<nav class="crumbs tour__crumbs" aria-label="<?php echo esc_attr__( 'Breadcrumb', 'viator-collector' ); ?>">
|
||||
<ol class="crumbs__list">
|
||||
<?php foreach ( $crumbs as $crumb ) : ?>
|
||||
<li><a href="<?php echo esc_url( $crumb[1] ); ?>"><?php echo esc_html( $crumb[0] ); ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
<li aria-current="page"><?php the_title(); ?></li>
|
||||
</ol>
|
||||
</nav>
|
||||
<?php echo vc_breadcrumb_html( vc_breadcrumb_trail(), get_the_title(), 'tour__crumbs' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
</div>
|
||||
<div class="container tour__layout">
|
||||
<div class="tour__main">
|
||||
|
||||
Reference in New Issue
Block a user