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 function to fix some for the event tracking issues from the facebook for WooCommerce 1.7.5 update. | |
add_action( 'woocommerce_init', 'wc_facebook_tracking_fixes' ); | |
function wc_facebook_tracking_fixes(){ | |
// Get the facebook integration class. | |
$facebook = WooCommerce::instance()->integrations->get_integrations()['facebookcommerce']; | |
// Add add to cart event tracking to allow for WooCommerce redirect to cart after adding product. | |
add_action('woocommerce_after_cart', array($facebook->events_tracker, 'inject_add_to_cart_event')); | |
} |
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 | |
/** | |
* Do not reduce stock if more then what is instock is ordered as all items will be back-ordered/made to order/shipped together, and someone else can have the item instock shipped immediately. | |
* TODO: Should probably check if the item allows backordering. | |
*/ | |
function wccustom_alter_order_item_quantity( $item_qty_ordered, $order, $item ) { | |
// Get the product object from the order item object. | |
$product = $item->get_product(); | |
// Some products (variations) can have their stock managed by their parent. Get the correct ID and then product object. | |
$product_id_with_stock = $product->get_stock_managed_by_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
<?php | |
/** | |
* Hook into order API response to add custom field data. | |
* | |
* @param $order_data array | |
* @param $order WC_Order | |
* @param $fields array | |
* @param $server 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
add_filter( 'wpcf7_validate_email*', 'custom_email_confirmation_validation_filter', 20, 2 ); | |
function custom_email_confirmation_validation_filter( $result, $tag ) { | |
$tag = new WPCF7_FormTag( $tag ); | |
if ( 'your-email' == $tag->name ) { | |
$your_email = isset( $_POST['your-email'] ) ? trim( $_POST['your-email'] ) : ''; | |
$manager_email = isset( $_POST['manager-email'] ) ? trim( $_POST['manager-email'] ) : ''; | |
if ( $your_email == $manager_email ) { | |
$result->invalidate( $tag, "Your email can NOT match your manager's email." ); |
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 a custom rule type to ACF. | |
function acf_location_rules_types( $choices ) { | |
$choices['Post']['post_visibility'] = 'Post Visibility'; | |
return $choices; | |
} | |
add_filter('acf/location/rule_types', 'acf_location_rules_types'); |
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 | |
/** | |
*Reduce the strength requirement on the woocommerce password. | |
* | |
* Strength Settings | |
* 3 = Strong (default) | |
* 2 = Medium | |
* 1 = Weak | |
* 0 = Very Weak / Anything | |
*/ |
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 | |
// Remove the Tax Line item from the cart. | |
function wc_remove_cart_tax_totals( $tax_totals, $instance ) { | |
if( is_cart() ) { | |
$tax_totals = array(); | |
} | |
return $tax_totals; | |
} |
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 | |
//http://wordpress.stackexchange.com/questions/104605/update-image-path-with-words-starting-uppercase-to-lowercase-chars | |
//make located image source lowercase | |
function replace_cb($matches) { | |
if (!empty($matches[1])) { | |
return 'src="'.strtolower($matches[1]).'"'; | |
} else { | |
return $matches[0]; | |
} | |
} |
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 | |
/** | |
* Woocommerce Custom Variation Output | |
* | |
* The following function allow for the theme to display product variations in a grid format. | |
* This code could be moved to a plugin but is in the theme function file as it used the | |
* themes grid system. | |
* | |
* @package WooGrid | |
* @since WooGrid 1.2 |
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
--If you want to remove WordPress user(s) and all their data here are SQL queries you should run over your database (just replace %USERS IDs% with ids of users need to be deleted. - http://www.loneshooter.com/wordpress-how-to-delete-users-with-sql-queries/ -- | |
-- Deletes any comments from specific user(s) | |
DELETE FROM wp_comments WHERE user_id IN (%USERS IDs%); | |
-- Deletes post meta for specific user(s) | |
DELETE t1 FROM wp_postmeta t1 | |
LEFT JOIN wp_posts t2 ON t1. post_id = t2.ID | |
WHERE post_author IN (%USERS IDs%); | |