Skip to content

Instantly share code, notes, and snippets.

View WazzaJB's full-sized avatar
🔺

Warren Bickley WazzaJB

🔺
View GitHub Profile
@WazzaJB
WazzaJB / responsive.js
Last active January 13, 2020 09:17
React Native Responsive Helper Function
import { Dimensions } from 'react-native';
/**
* Wrap a style rule in this responsive function to process dimensions
* @param {object} Object of queries containing style objects
*/
const responsive = (queries, dim = 'window') => {
const { width, height } = Dimensions.get(dim);
let styles = [];
@WazzaJB
WazzaJB / ShoppSampleHandler.php
Last active August 29, 2015 14:13
Shopp Sample Handling
<?php
class ShoppSampleHandler {
function __construct()
{
// If the sample post/get variable exists
if( isset($_REQUEST['sample-request']) )
{
// Hook into the action which adds it to cart
add_action( 'shopp_cart_before_add_item', array( &$this, 'manipulateSampleInfo' ) );
@WazzaJB
WazzaJB / gist:f7c75e05a325c86dd421
Created December 30, 2014 14:47
Advanced Custom Fields and Shopp Category UI Fix
<?php
/*
Simply include this file from your functions.php within your WordPress theme, do everything else as you would!
*/
if( ! class_exists('acf_shopp_category') ) :
class acf_shopp_category {
function __construct()
@WazzaJB
WazzaJB / orderSample.php
Last active January 8, 2019 14:40
This will allow you to add the ability to order samples in Magento - and what better, it is the first version of the code I have found which works in 1.8!
<?php
/**
* WJB - Order Samples in Magento 1.8
*
* Upload this file to the root of your Magento installation and then you will
* need to add the following snippet to your 'template/catalog/product/view.phtml'
*
* You may need to change some of the values below in the sample creation code
* but this is all commented so it should be simple enough - my advice would be
* to read through and edit where necessary
@WazzaJB
WazzaJB / Shopp Shipping.Methods in Cart
Last active December 28, 2015 01:39
Handling Shopp's shipping method selector in the cart. I couldn't find a decent action to hook into where 'is_cart_page()' also returned true, meaning that you can effectively have the shipping selector anywhere, although I have no idea what this will do - best just putting it in the cart ey ;)
<?php
/
*
ADD THIS CODE TO YOUR FUNCTIONS.PHP
*/
add_action('shopp_init', 'shopp_cart_shipping_handling');
function shopp_cart_shipping_handling( )
{
if ( array_key_exists('shipmethod', $_POST) )
@WazzaJB
WazzaJB / Shopp get_featured_products()
Created July 25, 2013 16:54
This is a simple function which allows you to get featured products when using the Shopp plugin.
@WazzaJB
WazzaJB / acf-taxonomy-depth.php
Last active July 24, 2024 18:14
Advanced Custom Fields Taxonomy Depth Location Rule
<?php
//ADD RULE TO SECTION
add_filter('acf/location/rule_types', 'acf_location_rules_types');
function acf_location_rules_types( $choices )
{
$choices['Other']['taxonomy_depth'] = 'Taxonomy Depth';
return $choices;
}
//MATCHING OPERATORS