diff --git a/src/wp-content/themes/wp-cms-example-theme/404.php b/src/wp-content/themes/wp-cms-example-theme/404.php new file mode 100644 index 00000000..92984158 --- /dev/null +++ b/src/wp-content/themes/wp-cms-example-theme/404.php @@ -0,0 +1,13 @@ + + +
+
+

404

+
+

Page not found.

+
+ + 280 && event.clientX < window.innerWidth * 0.45) { + navigation.style.flexBasis = event.clientX + 'px'; + updateLineNumbers(); + } +} + +function destroyEditorResizerCallback() { + document.documentElement.removeEventListener('mousemove', dragEditorResizerCallback, false); + document.documentElement.removeEventListener('mouseup', destroyEditorResizerCallback, false); +} + +function updateLineNumbers() { + // Remove all line numbers + lineNumbers.querySelectorAll('i').forEach(n => n.remove()); + + // Set up the line numbers container height + lineNumbers.style.height = mainContent.scrollHeight + 'px'; + + // Calculate how many line numbers we want and append them to the DOM + const totalNumbers = (mainContent.scrollHeight) / 35; + Array.from({length: totalNumbers}, () => { + lineNumbers.appendChild(document.createElement("i")); + }); +} diff --git a/src/wp-content/themes/wp-cms-example-theme/footer.php b/src/wp-content/themes/wp-cms-example-theme/footer.php new file mode 100644 index 00000000..0d90547e --- /dev/null +++ b/src/wp-content/themes/wp-cms-example-theme/footer.php @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/src/wp-content/themes/wp-cms-example-theme/functions.php b/src/wp-content/themes/wp-cms-example-theme/functions.php new file mode 100644 index 00000000..4a8ffe59 --- /dev/null +++ b/src/wp-content/themes/wp-cms-example-theme/functions.php @@ -0,0 +1,24 @@ + 'Primary Menu', + ) ); +} +add_action( 'init', 'wpcms\example_theme\setup_navigation' ); + +// Enqueue scripts and styles +function enqueue_stuff() { + wp_enqueue_style( 'general-style', get_stylesheet_uri() ); + wp_enqueue_script( 'global-js', get_template_directory_uri() . '/assets/js/global.js', array(), '1.0.0', true ); +} +add_action( 'wp_enqueue_scripts', 'wpcms\example_theme\enqueue_stuff' ); diff --git a/src/wp-content/themes/wp-cms-example-theme/header.php b/src/wp-content/themes/wp-cms-example-theme/header.php new file mode 100644 index 00000000..e357e0d8 --- /dev/null +++ b/src/wp-content/themes/wp-cms-example-theme/header.php @@ -0,0 +1,39 @@ + +> + + + + + +> + +Skip to content + + + + + +
+ +
+ +
diff --git a/src/wp-content/themes/wp-cms-example-theme/index.php b/src/wp-content/themes/wp-cms-example-theme/index.php new file mode 100644 index 00000000..28951768 --- /dev/null +++ b/src/wp-content/themes/wp-cms-example-theme/index.php @@ -0,0 +1,16 @@ + __( 'Previous page' ), + 'next_text' => __( 'Next page' ), + ) ); +} + +get_sidebar(); +get_footer(); diff --git a/src/wp-content/themes/wp-cms-example-theme/page.php b/src/wp-content/themes/wp-cms-example-theme/page.php new file mode 100644 index 00000000..60c863fb --- /dev/null +++ b/src/wp-content/themes/wp-cms-example-theme/page.php @@ -0,0 +1,10 @@ + +

Results for:

+ +

Sorry, but nothing matched your search query.

+ elements added via JS and styled with a CSS counter +*/ + +#line-numbers { + position: absolute; + top: 0; + left: 0; + overflow: hidden; + counter-reset: line; + padding: 0 10px; + pointer-events: none; +} + +#line-numbers i { + display: block; + line-height: 35px; +} + +#line-numbers i:before { + counter-increment: line; + content: counter(line); + display: inline-block; + padding: 0; + color: #888; +} + +/* Main content */ + +#main-content { + position: relative; + line-height: 1.8; + padding: 20px 20px 100px 50px; +} + +@media (min-width: 960px) { + #main-content { + padding: 30px 30px 140px 60px; + } +} + +#main-content h1 { + font-size: 25px; + margin-bottom: 20px; + color: var(--color-red); +} + +@media (min-width: 1100px) { + #main-content h1 { + font-size: 50px; + } +} + +#main-content h2, +#main-content h3 { + font-size: 20px; + margin: 60px 0 20px 0; +} + +@media (min-width: 1100px) { + #main-content h2, + #main-content h3 { + font-size: 40px; + } +} + +#main-content h4, +#main-content h5, +#main-content h6 { + font-size: 20px; + margin: 40px 0 20px 0; +} + +@media (min-width: 1100px) { + #main-content h4, + #main-content h5, + #main-content h6 { + font-size: 32px; + } +} + +#main-content p { + margin: 10px 0; +} diff --git a/src/wp-content/themes/wp-cms-example-theme/template-parts/listed-post.php b/src/wp-content/themes/wp-cms-example-theme/template-parts/listed-post.php new file mode 100644 index 00000000..ebbd9096 --- /dev/null +++ b/src/wp-content/themes/wp-cms-example-theme/template-parts/listed-post.php @@ -0,0 +1,8 @@ +
+
+

+
+
+ +
+
diff --git a/src/wp-content/themes/wp-cms-example-theme/template-parts/post-content.php b/src/wp-content/themes/wp-cms-example-theme/template-parts/post-content.php new file mode 100644 index 00000000..8bd5b3d4 --- /dev/null +++ b/src/wp-content/themes/wp-cms-example-theme/template-parts/post-content.php @@ -0,0 +1,8 @@ +
+
+

+
+
+ +
+
diff --git a/src/wp-content/themes/wp-cms-very-simple-theme/404.php b/src/wp-content/themes/wp-cms-very-simple-theme/404.php new file mode 100644 index 00000000..c7f315ac --- /dev/null +++ b/src/wp-content/themes/wp-cms-very-simple-theme/404.php @@ -0,0 +1,9 @@ + + +

404

+

Page not found.

+ + + + + diff --git a/src/wp-content/themes/wp-cms-very-simple-theme/functions.php b/src/wp-content/themes/wp-cms-very-simple-theme/functions.php new file mode 100644 index 00000000..3c257c9b --- /dev/null +++ b/src/wp-content/themes/wp-cms-very-simple-theme/functions.php @@ -0,0 +1,12 @@ + +> + + + + + +> + +

+ +
diff --git a/src/wp-content/themes/wp-cms-very-simple-theme/index.php b/src/wp-content/themes/wp-cms-very-simple-theme/index.php new file mode 100644 index 00000000..28951768 --- /dev/null +++ b/src/wp-content/themes/wp-cms-very-simple-theme/index.php @@ -0,0 +1,16 @@ + __( 'Previous page' ), + 'next_text' => __( 'Next page' ), + ) ); +} + +get_sidebar(); +get_footer(); diff --git a/src/wp-content/themes/wp-cms-very-simple-theme/page.php b/src/wp-content/themes/wp-cms-very-simple-theme/page.php new file mode 100644 index 00000000..60c863fb --- /dev/null +++ b/src/wp-content/themes/wp-cms-very-simple-theme/page.php @@ -0,0 +1,10 @@ + +

Results for:

+ +

Sorry, but nothing matched your search terms.

+ + +
diff --git a/src/wp-content/themes/wp-cms-very-simple-theme/template-parts/post-content.php b/src/wp-content/themes/wp-cms-very-simple-theme/template-parts/post-content.php new file mode 100644 index 00000000..6133c826 --- /dev/null +++ b/src/wp-content/themes/wp-cms-very-simple-theme/template-parts/post-content.php @@ -0,0 +1,2 @@ +

+ diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index 6355bc2d..d44099ad 100755 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -182,7 +182,7 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) { 'parent' => 'wp-logo-external', 'id' => 'support-forums', 'title' => __( 'Support' ), - 'href' => __( 'https://wordpress.stackexchange.com/' ), + 'href' => __( 'https://wpcms.dev/support/' ), ) ); diff --git a/src/wp-includes/class-wp-theme.php b/src/wp-includes/class-wp-theme.php index 531d4ece..bfbe0010 100755 --- a/src/wp-includes/class-wp-theme.php +++ b/src/wp-includes/class-wp-theme.php @@ -57,22 +57,11 @@ final class WP_Theme implements ArrayAccess { * @since 5.0.0 Added the Twenty Nineteen theme. * @since 5.3.0 Added the Twenty Twenty theme. * @since 5.6.0 Added the Twenty Twenty-One theme. + * @since WPCMS 6.1 Removed all themes, kept one default as example * @var string[] */ private static $default_themes = array( - 'classic' => 'WordPress Classic', - 'default' => 'WordPress Default', - 'twentyten' => 'Twenty Ten', - 'twentyeleven' => 'Twenty Eleven', - 'twentytwelve' => 'Twenty Twelve', - 'twentythirteen' => 'Twenty Thirteen', - 'twentyfourteen' => 'Twenty Fourteen', - 'twentyfifteen' => 'Twenty Fifteen', - 'twentysixteen' => 'Twenty Sixteen', - 'twentyseventeen' => 'Twenty Seventeen', - 'twentynineteen' => 'Twenty Nineteen', - 'twentytwenty' => 'Twenty Twenty', - 'twentytwentyone' => 'Twenty Twenty-One', + 'wp-cms-example-theme' => 'Example Theme', ); /** diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php index 4e1da3dd..ede231b6 100755 --- a/tests/phpunit/tests/customize/manager.php +++ b/tests/phpunit/tests/customize/manager.php @@ -77,17 +77,17 @@ public function tear_down() { /** * Get a core theme that is not the same as the current theme. * - * @throws Exception If an inactive core Twenty* theme cannot be found. + * @throws Exception If an inactive core theme cannot be found. * @return string Theme slug (stylesheet). */ private function get_inactive_core_theme() { $stylesheet = get_stylesheet(); foreach ( wp_get_themes() as $theme ) { - if ( $theme->stylesheet !== $stylesheet && 0 === strpos( $theme->stylesheet, 'twenty' ) ) { + if ( $theme->stylesheet !== $stylesheet ) { return $theme->stylesheet; } } - throw new Exception( 'Unable to find inactive twenty* theme.' ); + throw new Exception( 'Unable to find inactive theme.' ); } /** diff --git a/tests/phpunit/tests/rest-api/rest-themes-controller.php b/tests/phpunit/tests/rest-api/rest-themes-controller.php index 4b56fbb1..4f021e97 100755 --- a/tests/phpunit/tests/rest-api/rest-themes-controller.php +++ b/tests/phpunit/tests/rest-api/rest-themes-controller.php @@ -224,7 +224,7 @@ public function test_get_items_inactive() { ); $this->assertSameSets( $fields, array_keys( $data[0] ) ); - $this->assertContains( 'twentytwenty', wp_list_pluck( $data, 'stylesheet' ) ); + $this->assertContains( 'wp-cms-very-simple-theme', wp_list_pluck( $data, 'stylesheet' ) ); $this->assertNotContains( get_stylesheet(), wp_list_pluck( $data, 'stylesheet' ) ); } @@ -243,7 +243,7 @@ public function test_get_items_active_and_inactive() { $this->assertSame( 200, $response->get_status() ); $data = $response->get_data(); - $this->assertContains( 'twentytwenty', wp_list_pluck( $data, 'stylesheet' ) ); + $this->assertContains( 'wp-cms-very-simple-theme', wp_list_pluck( $data, 'stylesheet' ) ); $this->assertContains( get_stylesheet(), wp_list_pluck( $data, 'stylesheet' ) ); } diff --git a/tests/phpunit/tests/theme.php b/tests/phpunit/tests/theme.php index ba2cdfab..42cad881 100755 --- a/tests/phpunit/tests/theme.php +++ b/tests/phpunit/tests/theme.php @@ -6,20 +6,10 @@ * @group themes */ class Tests_Theme extends WP_UnitTestCase { - protected $theme_slug = 'twentyeleven'; - protected $theme_name = 'Twenty Eleven'; + protected $theme_slug = 'wp-cms-example-theme'; + protected $theme_name = 'Example Theme'; protected $default_themes = array( - 'twentyten', - 'twentyeleven', - 'twentytwelve', - 'twentythirteen', - 'twentyfourteen', - 'twentyfifteen', - 'twentysixteen', - 'twentyseventeen', - 'twentynineteen', - 'twentytwenty', - 'twentytwentyone', + 'wp-cms-example-theme', ); /** @@ -201,8 +191,8 @@ public function test_wp_get_theme_contents() { */ public function test_default_theme_in_default_theme_list() { $latest_default_theme = WP_Theme::get_core_default_theme(); - if ( ! $latest_default_theme->exists() || 'twenty' !== substr( $latest_default_theme->get_stylesheet(), 0, 6 ) ) { - $this->fail( 'No Twenty* series default themes are installed.' ); + if ( ! $latest_default_theme->exists() || 'wp-cms' !== substr( $latest_default_theme->get_stylesheet(), 0, 6 ) ) { + $this->fail( 'No WP-CMS series default themes are installed.' ); } $this->assertContains( $latest_default_theme->get_stylesheet(), $this->default_themes ); }