This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// only applies when SearchWP is active | |
function my_searchwp_live_search_get_search_form_engine() { | |
return 'my_supplemental_engine'; | |
} | |
add_filter( 'searchwp_live_search_get_search_form_engine', 'my_searchwp_live_search_get_search_form_engine' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'searchwp_live_search_base_styles', '__return_false' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// BEGIN WP Document Revisions/SearchWP integration (REQUIRES XPDF INTEGRATION EXTENSION) | |
// NOTE: after this snippet has been added to functions.php you will need to customize | |
// the Document weight on SearchWP's settings screen, adding a Custom Field with the | |
// name of 'wp_document_revision' and giving it the weight; that's where document | |
// content will be stored (as Custom Field content) | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_searchwp_search_regex_whitelist_exclusivity( $terms, $engine ) { | |
global $searchwp; | |
// we want to strip out any partial matches | |
$terms = ' ' . $terms . ' '; | |
$whitelisted_terms = $searchwp->extract_terms_using_pattern_whitelist( $terms ); | |
$terms = str_replace( ' ', ' ', $terms ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$post_types = array( 'my_post_type' ); | |
$taxonomy = array( 'my_taxonomy' ); | |
$order = 'DESC'; | |
$sql = "SELECT DISTINCT t.* | |
FROM $wpdb->terms AS t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Tell WP Views Parametric Search to restrict it's results pool | |
* to what SearchWP finds, based on our custom setup | |
*/ | |
// tell WP-Views to limit the results pool | |
function my_searchwp_wpvparametric( $query ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add a 'where will you be promoting ___' to AffiliateWP's registration form | |
add_action( 'affwp_register_fields_before_tos', function() { | |
?> | |
<p> | |
<label for="affwp-user-where">Where will you be promoting SearchWP? USE SPECIFIC URLs (e.g. websites, social networks, etc.)</label> | |
<textarea id="affwp-user-where" name="affwp-user-where"></textarea> | |
</p> | |
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( class_exists( 'SOME_CLASS' ) ) { | |
// automatically deactivate | |
require_once ABSPATH . '/wp-admin/includes/plugin.php'; | |
deactivate_plugins( __FILE__ ); | |
wp_die( 'SRY :(' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
print_r( SWP()->results_weights ); | |
/* ===================== OUTPUT ===================== | |
Primary array key is the $post->ID, each primary value contains the overall | |
weight for that $post in addition to the weight for each post type | |
Array |