Skip to content

Instantly share code, notes, and snippets.

Jon Christopher jchristopher

View GitHub Profile
@davekiss
davekiss / gist:2639184ac066c53416b23c5a66f42d1e
Created Feb 2, 2019
EDD Weekly Domain Report via Email
View gist:2639184ac066c53416b23c5a66f42d1e
/**
* 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')
);
@ramiabraham
ramiabraham / gethooks
Last active Dec 27, 2018
Copy all actions and filters in a plugin and save to a file.
View gethooks
#!/bin/bash
#
# Prints all hooks in a dir to a .log file.
#
# Permissions issues:
# run: chmod +x gethooks
#
# gist: https://gist.github.com/ramiabraham/e8356e00130351ddcbe2c62125e6c52a
#
# Easy usage:
@johnbillion
johnbillion / wp_mail.md
Last active Apr 1, 2019
WordPress Emails
View wp_mail.md

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here: https://github.com/johnbillion/wp_mail

@spivurno
spivurno / gw-gravity-forms-exclude-forms-form-list.php
Last active Dec 14, 2017
Gravity Wiz // Gravity Forms // Exclude Forms from Form List
View gw-gravity-forms-exclude-forms-form-list.php
<?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;
}
@jchristopher
jchristopher / gist:53d98d2a21ffad14e440
Created Jun 22, 2015
Programmatically implement SearchWP synonyms (you do not need the Term Synonyms extension)
View gist:53d98d2a21ffad14e440
<?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;
@rogerlos
rogerlos / searchwp_results_substitute_post_for_attachment.php
Created Nov 11, 2014
Wordpress SearchWP: Substitute Post for Attachment in Search Results
View searchwp_results_substitute_post_for_attachment.php
<?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.
*
@Rarst
Rarst / append.php
Last active Apr 27, 2016
My xhprof/uprofiler setup, tweaked for WordPress and more easily profiling segments.
View append.php
<?php
use Rarst\Profiler\Handler;
global $wp;
if ( Handler::$profiling && empty( $wp ) ) {
Handler::close();
}
@danielbachhuber
danielbachhuber / gist:8af274e2b7f21c8c3bb6
Created Jul 3, 2014
Post-style permalinks for your custom post types
View gist:8af274e2b7f21c8c3bb6
<?php
/**
* Post-style permalinks for your custom post types
* e.g. %year%/%monthnum%/%day%/%postname%
*/
function dbx_get_post_types() {
return array(
// replace with your custom post types
'my-custom-post-type'
);
@jchristopher
jchristopher / gist:10730056
Created Apr 15, 2014
Throttle the SearchWP indexer
View gist:10730056
<?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' );
@mattbanks
mattbanks / wp-setup.sh
Created Mar 14, 2014
Scaffold a new WordPress development site in Alfred, utilizing WP-CLI. Use this script to run as a Terminal Script. Customize for your theme needs, plugin needs, etc.
View wp-setup.sh
# 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
You can’t perform that action at this time.