Skip to content

Instantly share code, notes, and snippets.

View digiltd's full-sized avatar

Sam Turner digiltd

View GitHub Profile
@digiltd
digiltd / fn_woo_custom_cart_button_text.php
Last active August 29, 2015 14:02 — forked from jameskoster/gist:7691051
change add to cart button text based on purchase and add product quantity to button text
<?php
//Change add to cart button text on single product page
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );
function woo_custom_cart_button_text() {
global $woocommerce;
foreach($woocommerce->cart->get_cart() as $cart_item_key => $values ) {
<?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
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
<?php
add_filter('gettext', 'rename_admin_menu_items');
add_filter('ngettext', 'rename_admin_menu_items');
/**
* Replaces wp-admin menu item names
*
* @author Daan Kortenbach
*
* @param array $menu The menu array.
*
@digiltd
digiltd / fn_wp_fontawesome.php
Last active August 29, 2015 14:02
fn wp add Fontawesome to WP-Admin
<?php
// SOURCE: http://coolestguidesontheplanet.com/hooking-fontawesome-use-wordpress-dashboard-admin-menus/
function fontawesome_dashboard() {
wp_enqueue_style('fontawesome', 'http:////netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css', '', '4.0.3', 'all');
}
add_action('admin_init', 'fontawesome_dashboard');
/* The function is made of echoing the CSS style, with the font-family set to FontAwesome with the
@digiltd
digiltd / index.html
Created June 14, 2014 10:04
Bootstrap index.html blank
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Blank</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="shortcut icon" href="../favicon.ico">
</head>
<body>
@digiltd
digiltd / holderjs.js
Created June 14, 2014 17:21
holderjs.js placeholder theme format
Holder.add_theme("thumbnail", {
background: "#000",
foreground: "#aaa",
size: 11,
font: "Monaco",
fontweight: "normal",
text: "Thumbnail"
})
@digiltd
digiltd / index.php
Created June 17, 2014 05:23
woocommerce list / loop products
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 999
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
woocommerce_get_template_part( 'content', 'product' );
endwhile;
@digiltd
digiltd / functions_woo_hooks.php
Created June 17, 2014 20:37
woo hide cart and prices hooks
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
@digiltd
digiltd / holder-js-random-colour.js
Last active August 29, 2015 14:03
Add the color attributes to holder.js data-src using David Merfield's loverly Random Color script.
/*============================================
= Random colour picker =
============================================*/
/**
*
*
Description
@digiltd
digiltd / gist.js
Created June 26, 2014 12:39
Loop through and add a random background-color (David Merfiel's randomColor.js) css property to selected element(s)
// ## Description
// Loop through and adds a random background-color css property to selected element(s)
// ## Requirements
// https://github.com/davidmerfield/randomColor
$(document).ready(function() {
$(".rand-bg-color").each(function() {