concept-image / wp-search
A package for adding search components with Roots - Bedrock/Acorn/Sage
Requires
- php: >=8.3
- roots/acorn: >=4.3
This package is auto-updated.
Last update: 2025-08-22 14:23:05 UTC
README
WP Search is a Composer package that provides Blade components and server-side logic to add search functionality to a WordPress Bedrock/Acorn/Sage project.
Installation
Install the package via Composer:
composer require concept-image/wp-search
Publish views
After installing the package, publish the view, component and config files so you can customize them:
wp acorn vendor:publish --tag="wp-search"
Configuration
Configuration options live in config/search.php
. Modify this file to change default behavior.
In this file you need to set your desired options, such as:
post_types
: An array of post types to include in search results.default
: The engine you wish to use for the search. (wp_query or swp_query)
If you use SWP_Query, you need to install the plugin with composer.
Usage
Once the views are published, you can edit them under :
resources/views/components/search/
for the search components like toggle buttons, filters, and results.resources/views/components/cards/search-card.blade.php
for the search result card.
To add the search popup you can add this component after the <main>
on your app template :
<x-search-popup />
You can add a button to open/close the search popup with the component :
<x-search-button />
And Finaly you must add the Alpine.js DATA to the body tag for the search popup to work.
x-data="{ searchOpen: false }"
Contributing
Contributions are welcome. Please open an issue or submit a pull request with a clear description of the change.
License
This package is open-source under the MIT license. See LICENSE.md for details.