Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: ✨ Add shortcode site-search to display Google search results #14

Merged
merged 2 commits into from
Oct 10, 2023

Conversation

knice
Copy link
Member

@knice knice commented Oct 10, 2023

This shortcode is built to be a zero-configuration way of adding Google site search to our WordPress theme.

The short code site-search is replaced with the script tag and properly configured DOM element for displaying search results from Google. It changes Google's expected URL query parameter from q to s, which is the WordPress default.

This shortcode, dropped into the search page template, will instantly replace WordPress search results with Google site search results.

@knice knice requested a review from Herm71 October 10, 2023 00:44
@knice knice added the enhancement New feature or request label Oct 10, 2023
Copy link
Member

@Herm71 Herm71 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well unless you're in a local environment. Approving for now.

@knice
Copy link
Member Author

knice commented Oct 10, 2023

@Herm71 I worked out a regex that should properly switch to ucsc.edu search when the site is in development or local

@knice knice merged commit 6eac524 into main Oct 10, 2023
@Herm71 Herm71 deleted the 2023-10-09-search-shortcode branch October 27, 2023 14:13
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants