PluginProbe
Extendify / 3.1.0
Extendify v3.1.0
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / tests / playwright / QuickEdit / header-cta / setup.php

setup.php in Extendify 3.1.0, at tests/playwright/QuickEdit/header-cta/setup.php

46 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 require '/wordpress/wp-load.php';
3
4 // The button + phone CTAs live in a *template part* (the header), not page
5 // content, so Quick Edit routes through the template-part load + save path
6 // (resolveTarget's PART_ATTR branch → TemplatePartBlockFinder) rather than the
7 // post path. The phone is a core/paragraph whose entire text is a single tel:
8 // link — the target of the save-time href sync and the link-activation on open.
9 // Block themes prefer a DB-resolved wp_template_part over the theme's
10 // filesystem part for the same slug + wp_theme term; the base template still
11 // invokes it with tagName="header", so role="banner" is preserved for locators.
12 $headerContent = "<!-- wp:site-title /-->\n"
13 . "<!-- wp:paragraph -->\n"
14 . '<p><a href="tel:0123456789">01 23 45 67 89</a></p>' . "\n"
15 . "<!-- /wp:paragraph -->\n"
16 . "<!-- wp:buttons -->\n"
17 . "<div class=\"wp-block-buttons\">\n"
18 . "<!-- wp:button -->\n"
19 . '<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="https://example.com/desks">Shop Desks</a></div>' . "\n"
20 . "<!-- /wp:button -->\n"
21 . "</div>\n"
22 . "<!-- /wp:buttons -->";
23
24 $headerPartId = wp_insert_post([
25 'post_type' => 'wp_template_part',
26 'post_status' => 'publish',
27 'post_name' => 'header',
28 'post_title' => 'Header',
29 'post_content' => $headerContent,
30 ]);
31 wp_set_object_terms($headerPartId, 'extendable', 'wp_theme');
32
33 // A static front page so `/` is stable. Its content is irrelevant — the CTAs
34 // under test live in the header part, which renders on every template (so the
35 // default "Hello world!" post at /?p=1 is the site-wide cross-check).
36 $frontId = wp_insert_post([
37 'post_type' => 'page',
38 'post_status' => 'publish',
39 'post_title' => 'Header CTA Home',
40 'post_content' => "<!-- wp:heading -->\n"
41 . '<h2 class="wp-block-heading">Header CTA home.</h2>'
42 . "\n<!-- /wp:heading -->",
43 ]);
44 update_option('show_on_front', 'page');
45 update_option('page_on_front', $frontId);
46