fix: styled city cards on region pages; regions follow All Tours in the menu

- Region page city list uses the design's destination rail (dcard) instead of
  the unstyled pre-reskin card template
- Header menu: structure regions are inserted after the top-level link to the
  tours archive instead of at the end
- Plugin 1.9.2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-29 16:27:31 +03:30
parent f58ed49d07
commit d0c48e0e8e
4 changed files with 60 additions and 17 deletions

View File

@@ -17,12 +17,29 @@ class VC_Menu {
if ( empty( $args->theme_location ) || self::LOCATION !== $args->theme_location ) {
return $items;
}
$order = count( $items );
$extra = self::items();
foreach ( $extra as $item ) {
$item->menu_order = ++$order;
if ( ! $extra ) {
return $items;
}
return array_merge( $items, $extra );
// Regions go right after the top-level link to the tours archive ("All
// Tours"); without one, at the end. The walker renders top-level items
// in array order.
$items = array_values( $items );
$position = count( $items );
$archive = untrailingslashit( (string) get_post_type_archive_link( 'viator_tour' ) );
foreach ( $items as $i => $item ) {
if ( empty( $item->menu_item_parent ) && '' !== $archive && untrailingslashit( (string) $item->url ) === $archive ) {
$position = $i + 1;
break;
}
}
array_splice( $items, $position, 0, $extra );
foreach ( $items as $i => $item ) {
$item->menu_order = $i + 1;
}
return $items;
}
/**