Version Description
- New action:
searchwp_live_search_alter_results - Adds Relevanssi support (based on Dave's WordPress Live Search's implementation)
Download this release
Release Info
| Developer | jchristopher |
| Plugin | |
| Version | 1.0.5 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.4 to 1.0.5
- includes/class-client.php +2 -0
- includes/class-relevanssi-bridge.php +22 -0
- readme.txt +5 -1
- searchwp-live-ajax-search.php +6 -2
includes/class-client.php
CHANGED
|
@@ -115,6 +115,8 @@ class SearchWP_Live_Search_Client extends SearchWP_Live_Search {
|
|
| 115 |
// normally would in a theme template (and reducing support requests)
|
| 116 |
query_posts( $args );
|
| 117 |
|
|
|
|
|
|
|
| 118 |
// optionally pass along the SearchWP engine if applicable
|
| 119 |
$engine = isset( $_REQUEST['swpengine'] ) ? sanitize_text_field( $_REQUEST['swpengine'] ) : '';
|
| 120 |
|
| 115 |
// normally would in a theme template (and reducing support requests)
|
| 116 |
query_posts( $args );
|
| 117 |
|
| 118 |
+
do_action( 'searchwp_live_search_alter_results' );
|
| 119 |
+
|
| 120 |
// optionally pass along the SearchWP engine if applicable
|
| 121 |
$engine = isset( $_REQUEST['swpengine'] ) ? sanitize_text_field( $_REQUEST['swpengine'] ) : '';
|
| 122 |
|
includes/class-relevanssi-bridge.php
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
// class written by https://wordpress.org/plugins/daves-wordpress-live-search/
|
| 4 |
+
|
| 5 |
+
// Relevanssi "bridge" plugin
|
| 6 |
+
class SearchWP_Live_Search_Relevanssi_Bridge {
|
| 7 |
+
|
| 8 |
+
function __construct() {
|
| 9 |
+
add_action( 'searchwp_live_search_alter_results', array( 'SearchWP_Live_Search_Relevanssi_Bridge', 'alter_results' ), 10, 3 );
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
static function alter_results( $wpQueryResults, $maxResults, $results ) {
|
| 13 |
+
global $wp_query;
|
| 14 |
+
relevanssi_do_query( $wp_query );
|
| 15 |
+
$results->relevanssi = true;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
if ( function_exists( 'relevanssi_do_query' ) ) {
|
| 21 |
+
new SearchWP_Live_Search_Relevanssi_Bridge();
|
| 22 |
+
}
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: jchristopher
|
|
| 3 |
Tags: search, live, ajax
|
| 4 |
Requires at least: 3.9
|
| 5 |
Tested up to: 3.9.1
|
| 6 |
-
Stable tag: 1.0.
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
|
@@ -76,6 +76,10 @@ SearchWP Live Ajax Search uses a filter — <a href="https://searchwp.com/docs/
|
|
| 76 |
|
| 77 |
== Changelog ==
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
= 1.0.4 =
|
| 80 |
* Corrected the default results template folder name to be `searchwp-live-ajax-search` as is in the documentation
|
| 81 |
* Improvement: hide the results box when query is emptied (props Lennard Voogdt)
|
| 3 |
Tags: search, live, ajax
|
| 4 |
Requires at least: 3.9
|
| 5 |
Tested up to: 3.9.1
|
| 6 |
+
Stable tag: 1.0.5
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
| 76 |
|
| 77 |
== Changelog ==
|
| 78 |
|
| 79 |
+
= 1.0.5 =
|
| 80 |
+
* New action: `searchwp_live_search_alter_results`
|
| 81 |
+
* Adds Relevanssi support (based on Dave's WordPress Live Search's implementation)
|
| 82 |
+
|
| 83 |
= 1.0.4 =
|
| 84 |
* Corrected the default results template folder name to be `searchwp-live-ajax-search` as is in the documentation
|
| 85 |
* Improvement: hide the results box when query is emptied (props Lennard Voogdt)
|
searchwp-live-ajax-search.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Plugin Name: SearchWP Live Ajax Search
|
| 4 |
Plugin URI: https://searchwp.com/
|
| 5 |
Description: Enhance your search forms with live search, powered by SearchWP (if installed)
|
| 6 |
-
Version: 1.0.
|
| 7 |
Author: Jonathan Christopher
|
| 8 |
Author URI: https://searchwp.com/
|
| 9 |
|
|
@@ -40,7 +40,7 @@ class SearchWP_Live_Search {
|
|
| 40 |
|
| 41 |
public $dir;
|
| 42 |
public $url;
|
| 43 |
-
public $version = '1.0.
|
| 44 |
|
| 45 |
function __construct() {
|
| 46 |
$this->dir = dirname( __FILE__ );
|
|
@@ -59,6 +59,10 @@ function searchwp_live_search_init() {
|
|
| 59 |
// else we'll prep the environment for the search form itself
|
| 60 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
| 61 |
include_once( dirname( __FILE__ ) . '/includes/class-client.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
$client = new SearchWP_Live_Search_Client();
|
| 63 |
$client->setup();
|
| 64 |
}
|
| 3 |
Plugin Name: SearchWP Live Ajax Search
|
| 4 |
Plugin URI: https://searchwp.com/
|
| 5 |
Description: Enhance your search forms with live search, powered by SearchWP (if installed)
|
| 6 |
+
Version: 1.0.5
|
| 7 |
Author: Jonathan Christopher
|
| 8 |
Author URI: https://searchwp.com/
|
| 9 |
|
| 40 |
|
| 41 |
public $dir;
|
| 42 |
public $url;
|
| 43 |
+
public $version = '1.0.5';
|
| 44 |
|
| 45 |
function __construct() {
|
| 46 |
$this->dir = dirname( __FILE__ );
|
| 59 |
// else we'll prep the environment for the search form itself
|
| 60 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
| 61 |
include_once( dirname( __FILE__ ) . '/includes/class-client.php' );
|
| 62 |
+
|
| 63 |
+
// Relevanssi support
|
| 64 |
+
include_once( dirname( __FILE__ ) . '/includes/class-relevanssi-bridge.php' );
|
| 65 |
+
|
| 66 |
$client = new SearchWP_Live_Search_Client();
|
| 67 |
$client->setup();
|
| 68 |
}
|
