| 1 |
<?php |
| 2 |
require '/wordpress/wp-load.php'; |
| 3 |
|
| 4 |
// Sidebar-mode scroll guards need a page tall enough to scroll |
| 5 |
// inside the wp-site-blocks container, plus a tagged block low enough on |
| 6 |
// the page that scroll-position changes are observable via getBoundingClientRect. |
| 7 |
$paragraphs = []; |
| 8 |
for ($i = 1; $i <= 30; $i++) { |
| 9 |
$paragraphs[] = "<!-- wp:paragraph -->\n" |
| 10 |
. "<p>Filler paragraph {$i} to make the page taller than the viewport.</p>\n" |
| 11 |
. '<!-- /wp:paragraph -->'; |
| 12 |
} |
| 13 |
|
| 14 |
$content = "<!-- wp:heading -->\n" |
| 15 |
. "<h2 class=\"wp-block-heading\">Top heading.</h2>\n" |
| 16 |
. "<!-- /wp:heading -->\n\n" |
| 17 |
. implode("\n\n", $paragraphs) |
| 18 |
. "\n\n<!-- wp:heading -->\n" |
| 19 |
. "<h2 class=\"wp-block-heading\">Scroll target heading.</h2>\n" |
| 20 |
. "<!-- /wp:heading -->\n"; |
| 21 |
|
| 22 |
$pageId = wp_insert_post([ |
| 23 |
'post_type' => 'page', |
| 24 |
'post_status' => 'publish', |
| 25 |
'post_title' => 'Sidebar Mode Scroll Home', |
| 26 |
'post_content' => $content, |
| 27 |
]); |
| 28 |
|
| 29 |
update_option('show_on_front', 'page'); |
| 30 |
update_option('page_on_front', $pageId); |
| 31 |
|