feat: starter guides for all 15 structure cities

Writes guides for the nine cities with no old page and adds Best time to
visit to all. The import now fills only empty fields and re-runs once, so
sites that already imported get the new values without losing edits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 10:10:01 +03:30
parent 2ded000a27
commit 25debff066
4 changed files with 184 additions and 13 deletions

View File

@@ -16,16 +16,16 @@ function test_bundled_guides_use_known_fields() {
function test_bundled_guides_have_core_text() {
foreach ( vc_test_bundled_guides() as $slug => $guide ) {
foreach ( array( 'tagline', 'language', 'currency', 'timezone', 'about_title', 'about' ) as $key ) {
foreach ( array( 'tagline', 'language', 'currency', 'timezone', 'best_time', 'about_title', 'about' ) as $key ) {
vc_assert_same( true, ! empty( $guide[ $key ] ), "$slug.$key empty" );
}
vc_assert_same( false, (bool) preg_match( '/elementor|\{|\}/', implode( ' ', $guide ) ), "$slug has page junk" );
}
}
function test_bundled_guides_cover_old_pages() {
function test_bundled_guides_cover_structure_cities() {
vc_assert_same(
array( 'las-vegas', 'miami', 'montreal', 'new-orleans', 'new-york-city', 'vancouver' ),
array( 'boston', 'chicago', 'las-vegas', 'los-angeles', 'miami', 'montreal', 'new-orleans', 'new-york-city', 'san-diego', 'san-francisco', 'seattle', 'toronto', 'vancouver', 'victoria', 'washington-dc' ),
( function ( $k ) { sort( $k ); return $k; } )( array_keys( vc_test_bundled_guides() ) )
);
}
@@ -44,3 +44,12 @@ function test_season_months_flip_south() {
vc_assert_same( 'September – November', $south['spring'] );
vc_assert_same( 'June – August', $south['winter'] );
}
function test_fill_empty_keeps_entered_text() {
$guide = VC_City_Guide::fill_empty(
array( 'tagline' => 'Mine', 'best_time' => '' ),
array( 'tagline' => 'Bundled', 'best_time' => 'May – June' )
);
vc_assert_same( 'Mine', $guide['tagline'] );
vc_assert_same( 'May – June', $guide['best_time'] );
}