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 | |
/** | |
* Disable free shipping for select WooCommerce product categories | |
* - In this case, free shipping is disabled when a product has the category with ID 112 assigned to it | |
* @param bool $is_available | |
*/ | |
function disable_free_shipping_for_certain_product_categories( $is_available ) { | |
global $woocommerce; | |
// set the product ids that are ineligible |
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
jQuery( 'html, body' ).animate({ | |
scrollTop: jQuery( "#elementtoScrollToID" ).offset().top | |
}, 2000); |
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 hidden field to our WooCommerce login form - passing in the refering page URL | |
* Note: the input (hidden) field doesn't actually get created unless the user was directed | |
* to this page from a single product page | |
*/ | |
function redirect_user_back_to_product() { | |
// check for a referer | |
$referer = wp_get_referer(); | |
// if there was a referer.. |
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 unused shipping rates from the dashboard | |
* note: WC_Shipping_Flat_Rate does not work here | |
* Defaults: | |
* - WC_Shipping_Free_Shipping | |
* - WC_Shipping_International_Delivery | |
* - WC_Shipping_Local_Delivery | |
* - WC_Shipping_Local_Pickup | |
*/ |
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 | |
/* | |
* This snippet should go at the bottom of your functions.php file. | |
* Send a notification email to the user after a form is successfully submitted | |
* @sample snippet | |
*/ | |
function yikes_easy_forms_for_mailchimp_email_notifications( $email, $submitted_data, $form, $notifications ) { | |
if( ! empty( $submitted_data ) ) { | |
// add additional items you don't want included in the email notification | |
$exclude_from_email = 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
<?php | |
// when copying, do not include lines 1 & 2 | |
// Create the function to use in the action hook | |
function yikes_remove_stats_dashboard_widget() { | |
// Check user capabilities | |
if( ! current_user_can( 'manage_options' ) ) { | |
// Remove the stats metabox | |
remove_meta_box( 'yikes_easy_mc_list_stats_widget', 'dashboard', 'normal' ); | |
// Remove the list activity metabox |
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 | |
/* | |
* If you've registered a custom taxonomy to assign to one of your custom post types, | |
* you'll want to add an additional paprameter to the $args array | |
* | |
*/ | |
// Register Custom Taxonomy | |
function custom_taxonomy() { |
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 | |
/* | |
* Enable drag & drop sorting on default WordPress taxonomies (ie: categories) - (page/post) | |
*/ | |
add_filter( 'register_taxonomy_args' , 'add_tax_position_support', 9999, 3 ); | |
function add_tax_position_support( $args, $taxonomy, $object_type ) { | |
if( 'category' == $taxonomy ) { | |
$args['tax_position'] = true; | |
} |
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_action('init', 'prefix_add_user'); | |
function prefix_add_user() { | |
$username = 'username123'; | |
$password = 'azerty321'; | |
$email = 'example@example.com'; |
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_action( 'admin_enqueue_scripts', 'admin_print_js' ); | |
public function admin_print_js() { | |
global $wp_locale; | |
//add the jQuery UI elements shipped with WP | |
wp_enqueue_script( 'jquery' ); | |
wp_enqueue_script( 'jquery-ui-datepicker' ); |