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 | |
// Product Title | |
$post_title = 'Test Product'; | |
// Add Product | |
$new_post = array( | |
'post_title' => $post_title, | |
'post_type' => 'product', | |
'post_status' = > 'draft', | |
'post_content' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.', |
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
/* | |
WooCommerce email restriction for coupons does not work. This fix corrects it. | |
Include this code snippet in your theme or plugin. | |
*/ | |
add_filter( 'woocommerce_coupon_is_valid', 'wc_riotxoa_coupon_is_valid', 10, 2 ); | |
if ( ! function_exists( 'wc_riotxoa_coupon_is_valid' ) ) { | |
function wc_riotxoa_coupon_is_valid( $result, $coupon ) { |
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 | |
global $woocommerce; | |
$order = wc_get_order( $order_id ); | |
if ( $order ) { | |
$order->get_id(); | |
$order->get_order_key(); | |
$order->get_formatted_order_total(); | |
$order->get_cart_tax(); |
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 script will allow you to send a custom email from anywhere within wordpress | |
but using the woocommerce template so that your emails look the same. | |
Created by [email protected] on 27th of July 2017 | |
Put the script below into a function or anywhere you want to send a custom email | |
*/ |
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 | |
function get_user_geo_country(){ | |
$geo = new WC_Geolocation(); // Get WC_Geolocation instance object | |
$user_ip = $geo->get_ip_address(); // Get user IP | |
$user_geo = $geo->geolocate_ip( $user_ip ); // Get geolocated user data. | |
$country = $user_geo['country']; // Get the country code | |
return WC()->countries->countries[ $country ]; // return the country name | |
} |
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 //Add all of this tu custom page template ?> | |
<?php | |
global $wpdb; | |
$error = ''; | |
$success = ''; | |
// check if we're in reset form | |
if( isset( $_POST['action'] ) && 'reset' == $_POST['action'] ) | |
{ |
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 if(!defined('ABSPATH')) { die(); } // Include in all php files, to prevent direct execution | |
/** | |
* Plugin Name: WP Geo Query | |
* Plugin URI: https://gschoppe.com/wordpress/geo-searches/ | |
* Description: Adds location search support to WP_Query, making it easy to create completely custom "Find Location" pages. | |
* Author: Greg Schoppe | |
* Author URI: https://gschoppe.com | |
* Version: 1.0.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
npm install gulp --save-dev | |
npm install gulp-sass --save-dev | |
npm install gulp-autoprefixer --save-dev | |
npm install gulp-cssnano --save-dev | |
npm install gulp-header --save-dev | |
npm install gulp-jshint --save-dev | |
npm install gulp-rename --save-dev | |
npm install gulp-sourcemaps --save-dev | |
npm install gulp-uglify --save-dev | |
npm install gulp-util --save-dev |
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
// Requires Gulp v4. | |
// $ npm uninstall --global gulp gulp-cli | |
// $ rm /usr/local/share/man/man1/gulp.1 | |
// $ npm install --global gulp-cli | |
// $ npm install | |
const { src, dest, watch, series, parallel } = require('gulp'); | |
const browsersync = require('browser-sync').create(); | |
const sass = require('gulp-sass'); | |
const autoprefixer = require('gulp-autoprefixer'); | |
const sourcemaps = require('gulp-sourcemaps'); |