Skip to content

Instantly share code, notes, and snippets.

View rayflores's full-sized avatar

Ray Flores rayflores

View GitHub Profile
@rayflores
rayflores / wp_delete_cookies.php
Created January 6, 2018 07:50
Delete and Expire Cookies - Before and After Plugin mod
<?php
/*
Plugin Name: Delete Cookies
Plugin URI: https://rayflores.com/plugins/wp-delete-cookies/
Description: Delete those unwanted cookies from sticking to the computer of the users for so long!
Version: 1.0
Author: Ray Flores
Author URI: https://www.rayflores.com/
*/
@rayflores
rayflores / modal_in_header.js
Created December 28, 2017 23:31
place beaver builder modal in header...
jQuery(document).ready(function()
// when the builder isn’t active…
if ( typeof FLBuilder == 'undefined' && typeof FLBuilderLayout != 'undefined' ) {
// grab main node and replace here, then grab inner header div and replace here
jQuery('.fl-node-5a4543bc2c784').insertAfter('.hero-inner');
}
//And here if you need it to run when the builder is active…
if ( typeof FLBuilder != 'undefined' ) {
// Your JS here.
}
@rayflores
rayflores / rearrange-product-addons.php
Created September 21, 2017 18:38
WooCommerce Rearrange Product Addons
<?php
/*
Plugin Name: WooCommerce Rearrange Product Addons
*/
$GLOBALS['Product_Addon_Display']; // get globals
// if variations - remove from single variation hook
function remove_plugin_actions(){
remove_action( 'woocommerce_single_variation', array( $GLOBALS['Product_Addon_Display'], 'display' ), 15);
@rayflores
rayflores / add_continue_shopping_button.php
Last active September 18, 2017 21:55
Add Continue Shopping Button to View Cart Message
<?php
/*
Plugin Name: Add Continue Shopping Button for WooCommerce
Plugin URI: https://rayflores.com/add-continue-shopping-button-on-single-product-page/
Description: Add a "Continue Shopping" button to the added to cart message on single product pages
Version: 1.0
Author: Ray Flores
Author URI: https://www.rayflores.com/
*/
add_filter( 'wc_add_to_cart_message_html', 'add_continue_shopping_button', 10, 2);
@rayflores
rayflores / shipping-label-text.php
Created September 5, 2017 16:16
Add text to shipping label
<?php
add_filter( 'woocommerce_cart_shipping_method_full_label', 'add_free_to_free_shipping_label', 10, 2);
function add_free_to_free_shipping_label( $label, $method ){
if ( $method->cost === '0.00' ){
$label = $label . ' (Free)';
}
return $label;
}
@rayflores
rayflores / list-products.php
Created August 4, 2017 15:19
get products
<?php
$base_rest_url = 'http://rayflores.staging.wpengine.com/wp-json/';
$woo_namespace_ver = 'wc/v1/products';
define( 'WC_CONSUMER_KEY', 'ck_d18285f04efdc33b160849682f40d4cf58a3540a' );
define( 'WC_CONSUMER_SECRET', 'cs_75b36a35c2645c518f60916f6e5387740e37389c' );
define( 'WC_BASE_REST_URL', $base_rest_url );
define( 'WC_NAMESPACE_VER', $woo_namespace_ver );
$params = array(
'consumer_key' => urlencode( WC_CONSUMER_KEY ),
'consumer_secret' => urlencode( WC_CONSUMER_SECRET )
@rayflores
rayflores / htaccess.htaccess
Last active January 26, 2017 21:57
301 perm redir to index alt TLD
# 1. GoDaddy -> login
# 2. Go to Domains
# 3. Go to Manage Hosting for that domain
# 4. Click on Manage for the site.
# You should now be in Control Panel backend of oldsite.com
# Either via FTP or FileManager (icon)
# find .htaccess file in root of domain folder
# open that file with a text editor (eg. Notepad or Notepad++)
# replace the contents of existing file with one of the following code snippets
@rayflores
rayflores / mods.php
Created December 9, 2016 19:46
sort not working PIP
<?php
add_action( 'wc_pip_styles','add_custom_css' );
function add_custom_css(){
?>
.customer-details {
margin-left: -15px;
margin-right: -15px;
}
.customer-details li {
padding: 0 15px;
<?php
/**
* Shipping Methods Display - cart-shipping.php template /woocommerce/cart/cart-shipping.php
*
* In 2.1 we show methods per package. This allows for multiple methods per order if so desired.
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.1.0
*/
<?php
$i=1;
foreach (WC()->cart->cart_contents as $item) {
if ( isset( $cart_item[ 'composite_data' ] ) && ! empty( $cart_item[ 'composite_parent' ] ) ) {
return $cart_item_class . ' item-' . $i + 10;
} elseif ( isset( $cart_item[ 'composite_data' ] ) && ! empty( $cart_item[ 'composite_children' ] ) ) {
return $cart_item_class . ' item-' . $i + 20;