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_action( 'admin_init', 'auto_distribute_cron' ); | |
add_action( 'mtm_auto_distribute_cron', 'mtm_push_nondistributed_posts' ); | |
if ( class_exists( 'WP_CLI' ) ) { | |
\WP_CLI::add_command( 'mtm_sj', 'mtm_push_nondistributed_posts' ); | |
} | |
/** | |
* Initialize the scheduled 'mtm_auto_distribute_cron' action. | |
* | |
* @return void |
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
/** | |
* Automatically distribute posts using Distributor's external connections. | |
* Only applies to published posts. | |
* | |
* @param [int] $post_id The post's ID. | |
* @return void | |
*/ | |
function auto_distribute( $post_id ) { | |
// Do not run this on unless a post is being updated. |
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
// Get URL Parameter | |
function getQueryVariable(variable) { | |
var query = window.location.search.substring(1); | |
var vars = query.split("&"); | |
for (var i=0;i<vars.length;i++) { | |
var pair = vars[i].split("="); | |
if(pair[0] == variable){return pair[1];} | |
} | |
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
/* | |
* Removes the product's thumbnail from the gallery if it's set in both. Useful after the Woo 3.0 update as the system now automatically add the image to the gallery. | |
* Drop this snippet in functions.php, reload the page, then delete the function. | |
*/ | |
add_action( 'init', 'remove_duplicate_gallery_images' ); | |
function remove_duplicate_gallery_images() { | |
// Get the products. |
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_filter( 'woocommerce_shipping_packages', 'free_shipping_wreaths' ); | |
function free_shipping_wreaths( $packages ) { | |
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' ); | |
foreach ( $packages as $i => $package ) { | |
$chosen_method = false; | |
if ( ! empty( $chosen_methods[ $i ] ) ) { |
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
SELECT * | |
FROM `wp_stream` | |
LEFT JOIN `wp_usermeta` | |
ON wp_stream.user_id=wp_usermeta.user_id | |
WHERE wp_stream.action LIKE "login" | |
AND wp_usermeta.meta_key LIKE '%wp_capabilities%' |
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
// TODO: look into basing this off order value. | |
//add_filter( 'woocommerce_email_enabled_new_renewal_order', 'unhook_those_pesky_emails', 20, 2 ); | |
//add_filter( 'woocommerce_email_enabled_customer_renewal_invoice', 'unhook_those_pesky_emails', 20, 2 ); | |
add_filter( 'woocommerce_email_enabled_customer_new_order', 'unhook_those_pesky_emails', 20, 2 ); | |
function unhook_those_pesky_emails( $active, $order ) { | |
//var_dump($order); | |
//exit; |
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_action('wp_head', 'update_meta_values'); | |
function update_meta_values() { | |
/* | |
* Takes a set of fields and resets them as part of a repeater | |
* To start, create a new repeater field and enter the slug in $new_repeater | |
* Find the fields you would like to move in wp_posts and set the post_parent to the new repeater's ID | |
*/ | |
// Slug of the new repeater |
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
/* | |
* Mailchimp API Calls | |
* V. 3.0 | |
*/ | |
//Push users to mailchimp on GF form completion | |
function mailchimp_newsletter_push_form_8($entry, $form) { | |
$list_id = ''; | |
$email = $entry[3]; |
NewerOlder