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 | |
// pause the indexer for 1s in between passes | |
function my_searchwp_indexer_throttle() { | |
return 1; | |
} | |
add_filter( 'searchwp_indexer_throttle', 'my_searchwp_indexer_throttle' ); | |
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 | |
/** | |
* This function will see if a PDF or other "attachment" post-type returned by SearchWP | |
* is present in a custom field in a regular post, and will return that post instead. Note | |
* this will only process documents which are referenced via the "attachment" post type. | |
* | |
* For example, you may have a product specification PDF and would like it in the search | |
* results, but would rather people got to it by visiting the product page itself. | |
* |
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 | |
/** | |
* Callback for saving values from metaboxes. | |
* | |
* @since 1.0.0 | |
* | |
* @param int $post_id The current post ID. | |
* @param object $post The current post object. | |
*/ | |
function tgm_save_meta_boxes( $post_id, $post ) { |
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 | |
use Rarst\Profiler\Handler; | |
global $wp; | |
if ( Handler::$profiling && empty( $wp ) ) { | |
Handler::close(); | |
} |
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_term_in', 'my_find_synonyms', 10, 2 ); | |
add_filter( 'searchwp_and_logic', '__return_false' ); | |
function my_find_synonyms( $term, $engine ) { | |
global $searchwp; | |
if( ! class_exists( 'SearchWP' ) || version_compare( $searchwp->version, '2.0.3', '<' ) ) { | |
return $term; |
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 | |
/** | |
* Auto-paginate after 500 words | |
*/ | |
add_action( 'loop_start', function( $query ) { | |
if ( ! is_single() || 'post' != get_post_type() || ! $query->is_main_query() ) | |
return; | |
$content = $query->posts[0]->post_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
<?php | |
/** | |
* Gravity Wiz // Gravity Forms // Exclude Forms from Form List | |
* http://gravitywiz.com | |
*/ | |
add_filter( 'query', function( $query ) { | |
if( rgget( 'page' ) != 'gf_edit_forms' ) { | |
return $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
// Paste into Firebug or Chrome Dev Tools console | |
// when viewing a page with multiple checkboxes. | |
(function(d) { | |
var input = d.querySelectorAll('input[type="checkbox"]'); | |
var i = input.length; | |
while (i--) { | |
input[i].checked = true; | |
} |
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
/** | |
* Add a weekly email report that summarizes which domains that | |
* your products are being used on. | |
*/ | |
add_filter( 'cron_schedules', function( $schedules ) { | |
$schedules['weekly'] = array( | |
'interval' => 604800, | |
'display' => __('Once Weekly') | |
); |
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
# Create directory for new site | |
cd ~/Sites | |
mkdir {query} | |
cd {query} | |
# Download latest version of WordPress | |
wp core download | |
# Setup wp-config file with WP_DEBUG enabled | |
wp core config --dbname={query} --dbuser=root --dbpass=root --dbprefix={query}wp_ --extra-php <<PHP |
OlderNewer