git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
| PayPal ExpressCheckout for WordPress | |
| Usage: | |
| 1. Declare an array with all the required parameters. | |
| 2. Create a new instance of the class. Set the second parameter to true if you want to enable SandBox mode. | |
| 3. Get the redirect URL with the doExpressCheckout function. | |
| 4. Redirect the user to that URL to request permission. | |
| 5. Use the processPayment function to process the payment. |
| <?php | |
| function get_ip_address() { | |
| $ip_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR'); | |
| foreach ($ip_keys as $key) { | |
| if (array_key_exists($key, $_SERVER) === true) { | |
| foreach (explode(',', $_SERVER[$key]) as $ip) { | |
| // trim for safety measures | |
| $ip = trim($ip); | |
| // attempt to validate IP | |
| if (validate_ip($ip)) { |
Update: please note that I have since switched to using a set of bash scripts instead of poluting the Git repository with git svn.
Author: Kaspars Dambis
kaspars.net / @konstruktors
| <?php | |
| /** | |
| * How to filter the value that would be returned by get_post_thumbnail_id() | |
| */ | |
| add_filter( 'get_post_metadata', function ( $value, $post_id, $meta_key, $single ) { | |
| // We want to pass the actual _thumbnail_id into the filter, so requires recursion | |
| static $is_recursing = false; | |
| // Only filter if we're not recursing and if it is a post thumbnail ID |
| <?php | |
| /** | |
| * Skip cart and redirect to direct checkout | |
| * | |
| * @package WooCommerce | |
| * @version 1.0.0 | |
| * @author Alessandro Benoit | |
| */ | |
| // Skip the cart and redirect to check out url when clicking on Add to cart |
| <?php | |
| /** | |
| * Better: use nonces, or less obvious query arguments. | |
| * http://glueckpress.com/?show_me=💩 | |
| */ | |
| if ( isset( $_GET['show_me'] ) && $_GET['show_me'] === '💩') { | |
| define( 'WP_DEBUG', true ); | |
| define( 'WP_DEBUG_DISPLAY', true ); | |
| } else { | |
| define( 'WP_DEBUG', false ); |
| <?php | |
| /** | |
| * Function that will automatically update ACF field groups via JSON file update. | |
| * | |
| * @link http://www.advancedcustomfields.com/resources/synchronized-json/ | |
| */ | |
| function jp_sync_acf_fields() { | |
| // vars |
| <?php | |
| // index WooCommerce product_variation SKUs with the parent post | |
| function my_searchwp_index_woocommerce_variation_skus( $extra_meta, $post_being_indexed ) { | |
| // we only care about WooCommerce Products | |
| if ( 'product' !== get_post_type( $post_being_indexed ) ) { | |
| return $extra_meta; | |
| } |
| <?php | |
| /* | |
| * Set the following constants in wp-config.php. | |
| * These should be added somewhere BEFORE the constant ABSPATH is defined. | |
| * | |
| * Author: Chad Butler | |
| * Author URI: https://butlerblog.com | |
| * | |
| * For more information and instructions, see: https://b.utler.co/Y3 |