param( [Parameter(Mandatory)][string]$Env ) . "$PSScriptRoot\common.ps1" $environment = Get-TestLabEnvironment -Name $Env $seedPhp = @' '; $content .= ''; $content .= '

This page intentionally includes one full-name and one abbreviated Bible reference for every book of the Bible across all installed local translations.

'; $content .= '
'; $content .= '
Book
'; foreach ($translations as $translation) { $content .= '
' . esc_html($translation[0]) . '
'; } foreach ($books as $book) { [$name, $abbr, $fullRef, $abbrRef] = $book; $content .= '
'; $content .= '
' . esc_html($name) . '
'; foreach ($translations as $translation) { [$code, $label] = $translation; $content .= '
'; $content .= '' . esc_html($fullRef) . ''; $content .= '' . esc_html($abbrRef) . ''; $content .= '
'; } $content .= '
'; } $content .= '
'; $existing = get_page_by_path('bible-reference-tooltip-test'); $post_data = [ 'post_title' => 'Bible Reference Tooltip Test', 'post_name' => 'bible-reference-tooltip-test', 'post_type' => 'page', 'post_status' => 'publish', 'post_content' => $content, ]; if ($existing) { $post_data['ID'] = $existing->ID; $page_id = wp_update_post($post_data, true); } else { $page_id = wp_insert_post($post_data, true); } if (is_wp_error($page_id)) { fwrite(STDERR, $page_id->get_error_message()); exit(1); } update_option('show_on_front', 'page'); update_option('page_on_front', (int) $page_id); $settings = get_option('brt_settings', []); if (is_array($settings)) { $settings['translation'] = $settings['translation'] ?? 'WEB'; update_option('brt_settings', $settings, false); } echo 'seeded front page ' . $page_id . ' with ' . count($books) . ' books, ' . count($translations) . ' translations, and ' . (count($books) * count($translations) * 2) . ' reference links'; '@ Write-ContainerPhpFile $environment '/tmp/brt-seed-front.php' $seedPhp Invoke-WpCli $environment 'wp eval-file /tmp/brt-seed-front.php --path=/var/www/html' | Out-Host