This file contains hidden or 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 | |
| /** | |
| * Plugin Name: WooCommerce Add CSS to Emails | |
| * Plugin URI: https://gist.github.com/BFTrick/01cc414ee56ce93715ec | |
| * Description: Add CSS styles to WooCommerce emails | |
| * Author: Patrick Rauland | |
| * Author URI: http://speakinginbytes.com/ | |
| * Version: 1.0 | |
| * | |
| * This program is free software: you can redistribute it and/or modify |
This file contains hidden or 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 | |
| /** | |
| * WordPress function for redirecting users on login based on user role | |
| */ | |
| function my_login_redirect( $url, $request, $user ){ | |
| if( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) { | |
| if( $user->has_cap( 'administrator' ) ) { | |
| $url = admin_url(); | |
| } else { |
This file contains hidden or 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 | |
| // Just require() this class via your theme's functions.php file. | |
| /* Then instantiate this at the top of your 404.php file with: | |
| if ( class_exists( 'Clean_404_Email' ) ) | |
| new Clean_404_Email; | |
| */ | |
| class Clean_404_Email { | |
| var $time, $request, $blog, $email, $theme, $theme_data, $site, $referer, $string, $address, $remote, $agent, $message; |
This file contains hidden or 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
| //Display Fields | |
| add_action( 'woocommerce_product_after_variable_attributes', 'variable_fields', 10, 2 ); | |
| //JS to add fields for new variations | |
| add_action( 'woocommerce_product_after_variable_attributes_js', 'variable_fields_js' ); | |
| //Save variation fields | |
| add_action( 'woocommerce_process_product_meta_variable', 'variable_fields_process', 10, 1 ); | |
| function variable_fields( $loop, $variation_data ) { | |
| ?> | |
| <tr> |
This file contains hidden or 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 function attaches the image to the post in the database, add it to functions.php */ | |
| function insert_attachment($file_handler,$post_id,$setthumb='false') { | |
| // check to make sure its a successful upload | |
| if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false(); | |
| require_once(ABSPATH . "wp-admin" . '/includes/image.php'); | |
| require_once(ABSPATH . "wp-admin" . '/includes/file.php'); | |
| require_once(ABSPATH . "wp-admin" . '/includes/media.php'); |
NewerOlder