Skip to content

Instantly share code, notes, and snippets.

View joedooley's full-sized avatar

Joe Dooley joedooley

  • Florida
  • 12:44 (UTC -04:00)
View GitHub Profile
@joedooley
joedooley / wc-rename-product-tabs.php
Last active November 1, 2015 18:55
Rename WooCommerce product tabs
<?php
add_filter( 'woocommerce_product_tabs', 'choosy_rename_woo_tabs', 98 );
/**
* Rename WooCommerce product tabs
*
* @author Joe Dooley
* @param tabs
*
*/
@joedooley
joedooley / wc-new-product-tabs.php
Created November 1, 2015 19:02
Create new WooCommerce product tabs
<?php
add_filter( 'woocommerce_product_tabs', 'choosy_new_woo_product_tab' );
/**
* Create new WooCommerce product tabs
*
* @author Joe Dooley
* @param tabs
*
*/
@joedooley
joedooley / 0_reuse_code.js
Created November 7, 2015 06:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
 
function child_manage_woocommerce_styles() {
//remove generator meta tag
@joedooley
joedooley / sm-annotated.html
Created November 8, 2015 09:24 — forked from hdragomir/sm-annotated.html
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@joedooley
joedooley / price.php
Created November 30, 2015 18:06 — forked from lmartins/price.php
Show the sale savings percentage besides the product price and sale flash
add_filter( 'woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2 );
function woocommerce_custom_sales_price( $price, $product ) {
$percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 );
return $price . sprintf( __(' Save %s', 'woocommerce' ), $percentage . '%' );
}
@joedooley
joedooley / woo.php
Created November 30, 2015 18:25 — forked from lmartins/woo.php
Get the top level categories assigned to a product
function mw_theme_categories( $context )
{
$args = array( 'taxonomy' => 'product_cat' );
$terms = wp_get_post_terms( $context['post']->ID ,'product_cat', $args );
foreach ($terms as $cat) {
if($cat->parent == 0){
$out = '<div class="prodLabel prodLabel--' . strtolower( $cat->name ) . '">';
$out .= "<a href='/product-category/$cat->slug'>$cat->name</a>";
$out .= '</div>';
echo $out;
@joedooley
joedooley / gulpfile.js
Created November 30, 2015 20:08 — forked from lmartins/gulpfile.js
Current Gulpfile configuration
'use strict';
var gulp = require('gulp'),
connect = require('gulp-connect'),
gulpLoadPlugins = require('gulp-load-plugins'),
cleanhtml = require('gulp-cleanhtml'),
dev = require('gulp-dev'),
browserSync = require('browser-sync'),
plugins = gulpLoadPlugins(),
webpack = require('webpack'),
@joedooley
joedooley / aa_login.php
Created December 1, 2015 20:44 — forked from ahmadawais/page-login.php
WordPress Frontend Login Page
<?php /* Template Name: Login Page AA */ ?>
<?php get_header(); ?>
<!-- section -->
<section class="aa_loginForm">
<?php global $user_login;
if(isset($_GET['login']) && $_GET['login'] == 'failed')
{
@joedooley
joedooley / .scss-lint.yml
Last active December 4, 2015 10:02
.sass-lint.yml file from the Bourbon Neat repo
scss_files: "assets/sass/*.scss"
linters:
BangFormat:
enabled: true
space_before_bang: true
space_after_bang: false
BorderZero:
enabled: false
convention: zero
ColorKeyword: