开发者 | msaari |
---|---|
更新时间 | 2023年4月20日 15:39 |
PHP版本: | 4.9 及以上 |
WordPress版本: | 6.2 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
core/search
search form.
This plugin is on GitHub
Feel free to open up issues at
https://github.com/msaari/relevanssi-live-ajax-search.
data-rlvlive="true"
) to the input field of your search form. You can find more information in the plugin documentation.Relevanssi Live Ajax Search uses a template loader, making it easy to replace the search results. There is a templates
folder in the plugin folder, which includes search-results.php
. This file is the template used to output search results. To customize the search results:
relevanssi-live-ajax-search
in your theme directory.search-results.php
file into the new folder.add_filter( 'relevanssi_live_search_base_styles', '__return_false' );
This filter hook removes the base styles that control the live search result position.
wp_dequeue_style( 'relevanssi-live-search' );
This removes the actual search result styles.
It does, Astra search form is just designed in a way that hides the search results. You can find solutions in the plugin documentation. The easiest solution is adding this to your theme functions.php
:
add_filter( 'relevanssi_live_search_add_result_div', '__return_false' );
There's a filter for that! Add this to your theme functions.php or in a code snippet:
add_filter( 'relevanssi_live_search_posts_per_page', function() { return 10; } );
This will show 10 results. You can adjust the number as you wish.
For some reason, the combination of Relevanssi Live Ajax Search, Relevanssi and WPML leads to problems. To solve this problem, use the WP_Query
mode of fetching the results. To activate the mode, add this to your theme functions.php:
add_filter( 'relevanssi_live_search_mode', function() { return 'wp_query'; } );
This will make Relevanssi Live Ajax Search use a different method of fetching the results. This method is compatible with WPML. This method uses the search-results-query.php
template instead of the default search-results.php
template in Relevanssi Live Ajax Search, so take note if you want to customize the template to use the right base template for your customization.
relevanssi_live_ajax_search_ajax_messages
filter hook return true
.rlv-parentel
attribute and located away from the input field, the results will be placed under the parent element and not under the input field.input
event, which makes the search respond to context menu paste.relevanssi-live-ajax-search
directory in your theme.relevanssi_live_search_messages_template
can be used to filter the messages template.relevanssi_live_search_get_template_part
has an extra parameter for the context of the template: it can be results
or messages
, depending which template is loaded.static_offset
helps when the JS counts the result box offset wrong. Setting this to false
may solve these problems.has-spinner
class to rlv-has-spinner
to avoid collisions with other plugins.relevanssi_live_search_control_plugins_during_search
functionality has been removed.aria-label
parameter to a separate span
element that is hidden from sight.relevanssi_live_search_base_styles
filter hook, which was in reverse: now it works as expected and disables styles when you give it false
.query_posts()
can lead to problems (for example with WPML). It is now possible to use a new WP_Query
instead, which is safer.relevanssi_live_search_mode
controls which mode is used: query_posts
(the default value) is the old way, any other value uses WP_Query.search-results-query.php
. This template is used for the WP_Query
method.relevanssi_live_search_status_location
controls where the total is displayed ('before', 'after' or nowhere for any other value, in which case only the screen reader status is added).relevanssi_live_search_add_result_div
controls whether an extra div is added for the results.