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 | |
| /* | |
| * https://remicorson.com/woocommerce-stripe-add-custom-metadata/ | |
| * Add "Billing Company" value to Stripe metadata | |
| * add this to function.php | |
| */ | |
| function filter_wc_stripe_payment_metadata( $metadata, $order, $source ) { | |
| $order_data = $order->get_data(); |
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 | |
| /** | |
| * Gravity Wiz // Gravity Forms // Validate that a Value Exists | |
| * | |
| * Ensure that a value entered in Form A has been previously submitted on Form B. This is useful if you're generating a reference number of some sort | |
| * on Form B and would like the user to enter it on Form A. | |
| * | |
| * @version 1.8 | |
| * @author David Smith <david@gravitywiz.com> | |
| * @license GPL-2.0+ |
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
| 1. Create a new directory; | |
| mkdir Apple\ Enterprise | |
| cd Apple\ Enterprise | |
| 2. Generate a certificate signing request | |
| openssl req -nodes -newkey rsa:2048 -keyout aps.key -out CertificateSigningRequest.certSigningRequest | |
| 3. With the information like so (ensure you give it a password): | |
| Country Name (2 letter code) [AU]:GB | |
| State or Province Name (full name) [Some-State]:London |
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
| # BEGIN WordPress | |
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteBase / | |
| RewriteRule ^index\.php$ - [L] | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteRule . /index.php [L] |
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
| /** | |
| * CORS for the WordPress REST API | |
| */ | |
| function kms_wp_rest_api_cors() { | |
| remove_filter('rest_pre_serve_request', 'rest_send_cors_headers'); | |
| add_filter('rest_pre_serve_request', function ($value) { | |
| header('Access-Control-Allow-Origin: *'); | |
| header('Access-Control-Allow-Methods: GET'); | |
| header('Access-Control-Allow-Credentials: true'); |
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
| /** | |
| * Add a 1% surcharge to your cart / checkout | |
| * change the $percentage to set the surcharge to a value to suit | |
| */ | |
| add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' ); | |
| function woocommerce_custom_surcharge() { | |
| global $woocommerce; | |
| if ( is_admin() && ! defined( 'DOING_AJAX' ) ) | |
| return; |
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
| /* Centre and crop an image with a fixed height */ | |
| .crop { | |
| position: relative; /* provide a positioning context */ | |
| overflow: hidden; | |
| height: 200px; /* make space */ | |
| } | |
| .crop img { | |
| position: absolute; | |
| left: -100%; /* anchor the image corners outside the viewable area (increase for large images) */ | |
| right: -100%; |
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
| Step 1: Add domain entry in hosts file (sudo nano /etc/hosts) | |
| 127.0.0.1 local-server.dev | |
| Step 2: Add redirection policy in IP-Tables | |
| sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 8888 |
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 | |
| /** | |
| * Return the right previous_post_link / next_post_link when change posts order | |
| * ref: https://1fix.io/blog/2014/09/09/get-right-previous_post_link-when-order-posts-by-menu_order/ | |
| * more reading : http://wordpress.stackexchange.com/questions/73190/can-the-next-prev-post-links-be-ordered-by-menu-order-or-by-a-meta-key | |
| */ | |
| function kms_previous_post_where() { | |
| global $post, $wpdb; | |
| return $wpdb->prepare( "WHERE p.menu_order < %s AND p.post_type = %s AND p.post_status = 'publish'", $post->menu_order, $post->post_type); |
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
| // Alerts | |
| @include alert-variant($background, $border, $text-color); | |
| // Background Variant | |
| @include bg-variant($parent, $color); | |
| // Border Radius | |
| @include border-top-radius($radius); | |
| @include border-right-radius($radius); | |
| @include border-bottom-radius($radius); |