Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<!-- /wp:post-template -->
<!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand All @@ -84,7 +84,7 @@
<!-- /wp:post-template -->
<!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand Down Expand Up @@ -118,7 +118,7 @@
<!-- /wp:post-template -->
<!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand Down Expand Up @@ -151,7 +151,7 @@
<!-- /wp:post-template -->
<!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand All @@ -173,7 +173,7 @@
<!-- /wp:post-template -->
<!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand All @@ -200,7 +200,7 @@
<!-- /wp:post-template -->
<!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<!-- /wp:post-template -->
<!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<!-- /wp:post-template -->
<!-- wp:query-no-results -->
<!-- wp:paragraph {"align":"center","placeholder":"<?php esc_attr_e( 'Add text or blocks that will display when a query returns no results.', 'twentytwentyfive' ); ?>"} -->
<p class="has-text-align-center"><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p class="has-text-align-center"><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand All @@ -57,7 +57,7 @@
<!-- /wp:post-template -->
<!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand All @@ -75,7 +75,7 @@
<!-- /wp:post-template -->
<!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand All @@ -100,7 +100,7 @@
<!-- /wp:post-template -->
<!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<!-- /wp:post-template -->
<!-- wp:query-no-results -->
<!-- wp:paragraph {"placeholder":"<?php esc_attr_e( 'Add text or blocks that will display when a query returns no results.', 'twentytwentyfive' ); ?>","fontSize":"medium"} -->
<p class="has-medium-font-size"><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p class="has-medium-font-size"><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand Down Expand Up @@ -116,7 +116,7 @@
<!-- /wp:group -->
<!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Title: List of posts, 1 column (search results)
* Slug: twentytwentyfive/template-query-loop-search
* Categories: query
* Inserter: no
* Block Types: core/query
* Description: A list of posts, 1 column, with featured image and post date.
*
* @package WordPress
* @subpackage Twenty_Twenty_Five
* @since Twenty Twenty-Five 1.6
*/

?>
<!-- wp:query {"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true,"taxQuery":null,"parents":[]},"align":"full","layout":{"type":"default"}} -->
<div class="wp-block-query alignfull">
<!-- wp:post-template {"align":"full","layout":{"type":"default"}} -->
<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var:preset|spacing|60","bottom":"var:preset|spacing|60"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull" style="padding-top:var(--wp--preset--spacing--60);padding-bottom:var(--wp--preset--spacing--60)">
<!-- wp:post-featured-image {"isLink":true,"aspectRatio":"3/2"} /-->
<!-- wp:post-title {"isLink":true,"fontSize":"x-large"} /-->
<!-- wp:post-content {"align":"full","fontSize":"medium","layout":{"type":"constrained"}} /-->
<!-- wp:post-date {"isLink":true,"style":{"spacing":{"margin":{"top":"var:preset|spacing|40"}}},"fontSize":"small"} /-->
</div>
<!-- /wp:group -->
<!-- /wp:post-template -->
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|60","bottom":"var:preset|spacing|60"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group" style="padding-top:var(--wp--preset--spacing--60);padding-bottom:var(--wp--preset--spacing--60)">
<!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
<!-- /wp:group -->
<!-- wp:group {"align":"wide","layout":{"type":"constrained"}} -->
<div class="wp-block-group alignwide">
<!-- wp:query-pagination {"paginationArrow":"arrow","align":"wide","layout":{"type":"flex","justifyContent":"space-between"}} -->
<!-- wp:query-pagination-previous /-->
<!-- wp:query-pagination-numbers /-->
<!-- wp:query-pagination-next /-->
<!-- /wp:query-pagination -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:query -->
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="wp-block-group" style="padding-top:var(--wp--preset--spacing--60);padding-bottom:var(--wp--preset--spacing--60)">
<!-- wp:query-no-results -->
<!-- wp:paragraph -->
<p><?php echo esc_html_x( 'Sorry, but nothing was found. Please try a search with different keywords.', 'Message explaining that there are no results returned from a search.', 'twentytwentyfive' ); ?></p>
<p><?php echo esc_html_x( 'No posts were found.', 'Message explaining that there are no results returned from a query.', 'twentytwentyfive' ); ?></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results -->
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<main class="wp-block-group" style="margin-top:var(--wp--preset--spacing--60)">
<!-- wp:query-title {"type":"search"} /-->
<!-- wp:pattern {"slug":"twentytwentyfive/hidden-search"} /-->
<!-- wp:pattern {"slug":"twentytwentyfive/template-query-loop"} /-->
<!-- wp:pattern {"slug":"twentytwentyfive/template-query-loop-search"} /-->
<!-- wp:pattern {"slug":"twentytwentyfive/more-posts"} /-->
</main>
<!-- /wp:group -->
Expand Down
47 changes: 47 additions & 0 deletions tests/phpunit/tests/theme/twentyTwentyFiveNoResultsCopy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Tests that Twenty Twenty-Five only asks for different search keywords on search results.
*
* @group themes
* @group ticket-63513
*/
class Tests_Theme_TwentyTwentyFiveNoResultsCopy extends WP_UnitTestCase {

const SEARCH_COPY = 'Please try a search with different keywords.';

/**
* @param string $file Path relative to the Twenty Twenty-Five theme directory.
* @return string File contents.
*/
private function get_theme_file( $file ) {
return file_get_contents( ABSPATH . 'wp-content/themes/twentytwentyfive/' . $file );
}

/**
* @dataProvider data_non_search_patterns
*
* @param string $pattern Pattern file name.
*/
public function test_non_search_patterns_do_not_ask_for_different_keywords( $pattern ) {
$this->assertStringNotContainsString( self::SEARCH_COPY, $this->get_theme_file( "patterns/$pattern.php" ) );
}

/**
* @return array[]
*/
public function data_non_search_patterns() {
return array(
'template-query-loop' => array( 'template-query-loop' ),
'template-home-news-blog' => array( 'template-home-news-blog' ),
'template-home-with-sidebar-news-blog' => array( 'template-home-with-sidebar-news-blog' ),
'template-home-posts-grid-news-blog' => array( 'template-home-posts-grid-news-blog' ),
'page-portfolio-home' => array( 'page-portfolio-home' ),
);
}

public function test_search_template_keeps_the_search_copy() {
$template = $this->get_theme_file( 'templates/search.html' );
$this->assertStringContainsString( 'twentytwentyfive/template-query-loop-search', $template );
$this->assertStringContainsString( self::SEARCH_COPY, $this->get_theme_file( 'patterns/template-query-loop-search.php' ) );
}
}
Loading