I hereby claim:
- I am jchristopher on github.
- I am jchristopher (https://keybase.io/jchristopher) on keybase.
- I have a public key whose fingerprint is C446 E843 8699 4276 7D70 3CF4 5C0A BFF4 8230 0414
To claim this, I am signing this object:
<?php | |
function my_searchwp_dwls_alter_results( $search_results, $deprecated, $daves_live_search ) { | |
global $wp_query; | |
if( class_exists( 'SearchWP' ) ) { | |
// remove Dave's pre_get_posts | |
remove_action( 'pre_get_posts', array( 'DavesWordPressLiveSearchResults', 'pre_get_posts' ) ); |
<?php get_header(); ?> | |
<?php | |
$number_of_feature_posts = 1; | |
$number_of_secondary_posts = 8; | |
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; | |
$how_many_secondary_posts_past = ($number_of_secondary_posts * ($paged - 1)); | |
$off = $number_of_feature_posts + (($paged > 1) ? $how_many_secondary_posts_past : 0); | |
?> |
<?php | |
// add support for strings like M&M in SearchWP | |
function my_searchwp_term_pattern_whitelist( $patterns ) { | |
$patterns[] = "/\\b([[:alnum:]]+\\s?(?:&\\s?[[:alnum:]]+)+)/is"; | |
} | |
add_filter( 'searchwp_term_pattern_whitelist', 'my_searchwp_term_pattern_whitelist' ); |
<?php | |
// pause the indexer for 1s in between passes | |
function my_searchwp_indexer_throttle() { | |
return 1; | |
} | |
add_filter( 'searchwp_indexer_throttle', 'my_searchwp_indexer_throttle' ); | |
<?php | |
/* Template Name: Advance Search Template */ | |
global $post; | |
// retrieve our search query if applicable | |
$query = isset( $_REQUEST['swpquery'] ) ? sanitize_text_field( $_REQUEST['swpquery'] ) : ''; | |
// retrieve our pagination if applicable |
I hereby claim:
To claim this, I am signing this object:
<?php | |
function my_admin_notices() { | |
$success = true; | |
if( $success ) { | |
?> | |
<div class="updated"> | |
<p><?php _e( '<strong>SUCCESS</strong> Success!', 'mytextdomain' ); ?></p> | |
</div> | |
<?php |
<?php | |
function my_get_search_form( $html ) { | |
// we need to append the current Forum ID so our future hook can use it | |
if( function_exists( 'bbp_get_forum_id' ) ) { | |
$forum_id = isset( $_REQUEST['swpforumid'] ) ? absint( $_REQUEST['swpforumid'] ) : bbp_get_forum_id(); | |
if( ! empty( $forum_id ) ) { | |
$html = str_replace( '</form>', '<input type="hidden" name="swpforumid" value="' . $forum_id . '" /></form>', $html ); | |
} | |
} |
<?php | |
// if your form is generated using get_search_form() you do not need to do this | |
// as SearchWP Live Search does it automatically out of the box | |
?> | |
<form action="" method="get"> | |
<p> | |
<label for="s"><?php _e( 'Search' , 'mytextdomain' ); ?></label> | |
<input type="text" name="s" id="s" value="" data-swplive="true" /> <!-- data-swplive="true" enables SearchWP Live Search --> | |
</p> |
<?php | |
add_filter( 'searchwp_live_search_hijack_get_search_form', '__return_false' ); |