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:
@@ -64,6 +64,35 @@ function hoho_banner_url( $fallback ) {
|
||||
return $url ? $url : hoho_asset( 'img/' . $fallback . '.webp' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Breadcrumb in the same markup as the plugin's vc_breadcrumb_html(), so
|
||||
* every page shares one style. $trail: list of [label, url]; Home is added.
|
||||
*/
|
||||
function hoho_breadcrumb_html( array $trail, $current ) {
|
||||
$trail = array_merge( array( array( __( 'Home', 'hoponhopoff' ), home_url( '/' ) ) ), $trail );
|
||||
$out = '<nav class="crumbs" aria-label="' . esc_attr__( 'Breadcrumb', 'hoponhopoff' ) . '"><ol class="crumbs__list">';
|
||||
foreach ( $trail as $item ) {
|
||||
$out .= '<li><a href="' . esc_url( $item[1] ) . '">' . esc_html( $item[0] ) . '</a></li>';
|
||||
}
|
||||
return $out . '<li aria-current="page">' . esc_html( $current ) . '</li></ol></nav>';
|
||||
}
|
||||
|
||||
/**
|
||||
* URL of the blog list (the Posts page, else a page slugged blogs/blog).
|
||||
*/
|
||||
function hoho_blog_url() {
|
||||
if ( get_option( 'page_for_posts' ) ) {
|
||||
return get_permalink( get_option( 'page_for_posts' ) );
|
||||
}
|
||||
foreach ( hoho_page_slugs()['blog'] as $slug ) {
|
||||
$page = get_page_by_path( $slug );
|
||||
if ( $page ) {
|
||||
return get_permalink( $page );
|
||||
}
|
||||
}
|
||||
return home_url( '/blogs/' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Social profile links (footer + contact page). Override with the
|
||||
* `hoho_socials` filter.
|
||||
|
||||
Reference in New Issue
Block a user