Divi.php
961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* SearchWP Divi.
*
* @package SearchWP
* @author Jon Christopher
*/
namespace SearchWP\Integrations;
/**
* Class Divi is responsible for customizing SearchWP's Native implementation to work with Divi queries.
*
* @since 4.1.5
*/
class Divi extends PageBuilder {
/**
* Name used for canonical reference to Integration.
*
* @since 4.1.5
* @var string
*/
protected $name = 'divi';
public function __construct() {
// Divi needs this to run every time.
$this->run_once = false;
$this->modify_native_behavior();
}
/**
* Prevent \SearchWP\Native from being strict to is_main_query()
*
* @since 4.1.8
* @param boolean $strict
* @param \WP_Query $query
* @return boolean
*/
public function strict( $strict, $query ) {
$strict = false;
// Prevent this from happening again.
if ( $this->run_once ) {
remove_filter( 'searchwp\native\strict', [ $this, 'strict' ], 990 );
}
return $strict;
}
}