-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Search bar to the homepage (#2801)
* Add the search bar to the front page * Add search result page * Add content type filter * Fix filter on pagination would result in 404 page - enhanced * Add comment for modify_header_template_part
- Loading branch information
Showing
7 changed files
with
159 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
wp-content/themes/pub/wporg-learn-2024/patterns/search-all-content.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
/** | ||
* Title: Search All Content | ||
* Slug: wporg-learn-2024/search-all-content | ||
* Inserter: no | ||
*/ | ||
|
||
?> | ||
|
||
<!-- wp:group {"style":{"spacing":{"margin":{"bottom":"var:preset|spacing|50"}}},"layout":{"type":"constrained","justifyContent":"left","contentSize":"750px"}} --> | ||
<div class="wp-block-group" style="margin-bottom:var(--wp--preset--spacing--50)"> | ||
|
||
<!-- wp:heading {"level":1} --> | ||
<h1 class="wp-block-heading"><?php esc_html_e( 'Search Results', 'wporg-learn' ); ?></h1> | ||
<!-- /wp:heading --> | ||
|
||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:group {"align":"wide","layout":{"type":"flex","flexWrap":"wrap","justifyContent":"space-between"},"style":{"spacing":{"margin":{"top":"0","bottom":"var:preset|spacing|50"}}}} --> | ||
<div class="wp-block-group alignwide" style="margin-top:0;margin-bottom:var(--wp--preset--spacing--50)"> | ||
|
||
<!-- wp:search {"label":"<?php esc_attr_e( 'Search', 'wporg-learn' ); ?>","showLabel":false,"placeholder":"<?php esc_attr_e( 'Search for resources', 'wporg-learn' ); ?>","width":290,"widthUnit":"px","buttonText":"<?php esc_attr_e( 'Search', 'wporg-learn' ); ?>","buttonPosition":"button-inside","buttonUseIcon":true} /--> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"flex","flexWrap":"nowrap"},"className":"wporg-query-filters"} --> | ||
<div class="wp-block-group wporg-query-filters"> | ||
<!-- wp:wporg/query-filter {"key":"content_type","multiple":false} /--> | ||
<!-- wp:wporg/query-filter {"key":"level","multiple":false} /--> | ||
</div> | ||
<!-- /wp:group --> | ||
|
||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:wporg-learn/search-results-context {"style":{"spacing":{"padding":{"bottom":"var:preset|spacing|20"}},"elements":{"link":{"color":{"text":"var:preset|color|charcoal-4"}}}},"textColor":"charcoal-4","fontSize":"small"} /--> | ||
|
||
<!-- wp:query {"className":"wporg-learn-card-grid","queryId":1,"query":{"perPage":12,"pages":0,"offset":0,"order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true,"parents":[]}} --> | ||
<div class="wp-block-query wporg-learn-card-grid"> | ||
|
||
<!-- wp:post-template {"style":{"spacing":{"blockGap":"var:preset|spacing|50"}},"layout":{"type":"grid","columnCount":null,"minimumColumnWidth":"330px"}} --> | ||
|
||
<!-- wp:template-part {"slug":"card","className":"has-display-contents"} /--> | ||
|
||
<!-- /wp:post-template --> | ||
|
||
<!-- wp:query-no-results --> | ||
|
||
<!-- wp:pattern {"slug":"wporg-learn-2024/query-no-results"} /--> | ||
|
||
<!-- /wp:query-no-results --> | ||
|
||
<!-- wp:query-pagination {"layout":{"type":"flex","justifyContent":"center"}} --> | ||
|
||
<!-- wp:query-pagination-previous {"label":"Previous"} /--> | ||
|
||
<!-- wp:query-pagination-numbers /--> | ||
|
||
<!-- wp:query-pagination-next {"label":"Next"} /--> | ||
|
||
<!-- /wp:query-pagination --> | ||
|
||
</div> | ||
<!-- /wp:query --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
wp-content/themes/pub/wporg-learn-2024/templates/search-all.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- wp:template-part {"slug":"header-second","className":"has-display-contents","tagName":"div"} /--> | ||
|
||
<!-- wp:group {"tagName":"main","layout":{"type":"constrained"},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} --> | ||
<main class="wp-block-group entry-content"> | ||
|
||
<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"left":"var:preset|spacing|edge-space","right":"var:preset|spacing|edge-space","top":"var:preset|spacing|50","bottom":"var:preset|spacing|50"}}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group alignfull" style="padding-top:var(--wp--preset--spacing--50);padding-right:var(--wp--preset--spacing--edge-space);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--edge-space)"> | ||
|
||
<!-- wp:pattern {"slug":"wporg-learn-2024/search-all-content"} /--> | ||
|
||
</div> | ||
<!-- /wp:group --> | ||
|
||
</main> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:template-part {"slug":"footer"} /--> |