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
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
//woocommerce gallery - main header | |
$('.woocommerce-main-image').click(function() { | |
var $main_image = $('a.woocommerce-main-image').attr('href'); | |
var $items = new Array(); | |
var link = $('a.woocommerce-main-image').attr('href'); | |
var alt = $('a.woocommerce-main-image').find('img').attr('alt'); | |
var mainitem = { src: link, title: alt }; | |
$items.push(mainitem); |
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
//Load GA Plugin. If unable to load, wait 50 milliseconds and attempt load again. | |
function providePlugin(pluginName, pluginConstructor) { | |
if (window.ga && document.body ) { | |
ga('provide', pluginName, pluginConstructor); | |
} | |
else { | |
window.setTimeout(function() { | |
providePlugin('main_analytics', gaEventsLoader); | |
}, | |
50); |
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
function change_acf_meta_keys() { | |
global $wpdb; | |
$values = array( | |
"0" => array( | |
'old_value' => 'foo1', | |
'new_value' => 'bar1', | |
), | |
"1" => array( |
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]; |
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. |
NewerOlder