Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search form in search results and one liners #369

Merged
merged 2 commits into from
Aug 13, 2024
Merged
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
24 changes: 24 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,30 @@ function c4aa_add_body_class_from_acf_options_on_single_or_page( $classes ) {
}
add_filter( 'body_class', 'c4aa_add_body_class_from_acf_options_on_single_or_page' );

// Adds a search form to the search results page.
// so if you search for something and don't find it, you can search again!

/**
* Setup a custom hook before the second post on the search page
*/
add_action( 'the_post', function( $post, \WP_Query $q )
{
if( $q->is_search() && $q->is_main_query() && 0 === $q->current_post )
{
do_action( 'wpse_before_second_post_in_search' );
}
}, 10, 2 );

/**
* Inject a Div after the first post on the search page
*/
add_action( 'wpse_before_second_post_in_search', function()
{
echo '<article class="entry search-results-search-form
"><div class="entry-content"><div class="wp-block-group"><div class="wp-block-group__inner-container search-form-in-results">';
echo get_search_form( array('label' => 'Didn\'t find what you\'re looking for?', 'placeholder' => 'Search again...') );
echo '</div></div></div></article>';
} );

// Initialize Duotone on all post-thumbnails on archives. The specific color
// scheme is set by filtering the post class below, and overriding the
Expand Down
3 changes: 2 additions & 1 deletion src/css/_01-settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@
*/

@media screen and (prefers-reduced-motion: reduce) {
* {
*, *::before, *::after {
/* Very short durations means JavaScript that relies on events still works */
animation-duration: 0.001ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.001ms !important;
scroll-behavior: auto !important;
}
}
3 changes: 3 additions & 0 deletions src/css/_02-elements.scss
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ table strong {
*
*/

h1,h2,h3,h4,h5,h6 {
text-wrap: balance;
}

// Apply styles to headings

Expand Down
20 changes: 20 additions & 0 deletions src/css/_04-content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ article.type-people .entry-content .wp-block-advanced-columns-column__inner figu

#simple-banner {

.simple-banner-text {
text-wrap: balance;
}

& a {
text-decoration: 2px dotted underline;
}
Expand All @@ -317,6 +321,18 @@ article.type-people .entry-content .wp-block-advanced-columns-column__inner figu
}
}

// Search Results Page
// search form is inserted at the top of the results. This is the styling for that form.

article entry.search-form-in-results {
width: 100%;
}

article .search-form-in-results form .search-field {
width: 70%;
margin-right: 1rem;
}

// RELATED POSTS

.taxopress-related-posts {
Expand All @@ -343,6 +359,10 @@ article.type-people .entry-content .wp-block-advanced-columns-column__inner figu
padding: 0
}

.frm-star-group .frmsvg {
fill: var(--color-brandYellow);
}

input + .frm_description,
select + .frm_description,
textarea + .frm_description,
Expand Down
Loading