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( 'init', 'check_for_content', 30 ); | |
function check_for_content( $post_id ) { | |
$args = array( | |
'posts_per_page' => -1, | |
'offset' => 0, | |
'category' => '', | |
'category_name' => '', | |
'orderby' => 'date', | |
'order' => 'DESC', |
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
//By buddel - http://php.net/manual/en/function.array-search.php#usernotes | |
function recursive_array_search($needle,$haystack) { | |
foreach($haystack as $key=>$value) { | |
$current_key=$key; | |
if($needle===$value OR (is_array($value) && recursive_array_search($needle,$value) !== false)) { | |
return true; | |
} | |
} | |
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 retrieve_the_content( $var1 ) { | |
global $post; | |
return strip_tags($post->post_content); | |
} | |
function yoast_custom_meta_variables() { | |
wpseo_register_var_replacement( '%%the_content%%', 'retrieve_the_content', 'basic', 'Replaced with The Content' ); | |
} | |
add_action( 'wpseo_register_extra_replacements', 'yoast_custom_meta_variables' ); |
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
//Replace og:image with either the post featured image, or an image of the speaker | |
//Requires Yoast | |
add_action( 'wpseo_opengraph', 'replace_og_image', 30 ); | |
function replace_og_image() { | |
global $post; | |
$featured_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); | |
$speaker = get_field('speaker', $post->ID); |
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
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
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
/* | |
* 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
/* | |
* 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
function change_acf_meta_keys() { | |
global $wpdb; | |
$values = array( | |
"0" => array( | |
'old_value' => 'foo1', | |
'new_value' => 'bar1', | |
), | |
"1" => array( |
OlderNewer