Skip to content

Instantly share code, notes, and snippets.

@orionrush
orionrush / fetch_RICG_thumbnail
Last active August 29, 2015 14:21
function to leverage the RICG WP plugin to deliver responsive images with srcset attr using wp_get_attachment_image
/**
* Leverages the RICG WP plugin to deliver responsive images with srcset attr
*
* @param $post_ID
* @param $thumb_id
* @param $size
* @return mixed / wp_get_attached_image markup
*
* @uses PHP 5.2+ due to PATHINFO_FILENAME
* @uses wp_get_attachment_image
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@orionrush
orionrush / gist:2de5fc246e611e5861a3
Last active August 29, 2015 14:04
Two ways to delete WP taxonomies and their terms
<?php
register_uninstall_hook( __FILE__, 'do_delete_terms_wpdb' );
/**
* Delete database entries of terms and taxonomies using wordpress SQL api $wpdb
*
* @global $wpdb
* @wp-hook register_uninstall_hook
* @author Travis Smith
* http://wpsmith.net/2014/wp/plugin-uninstall-delete-terms-taxonomies-wordpress-database/
@orionrush
orionrush / WooCommerce XNum to cart
Last active August 29, 2015 14:01 — forked from claudiosanches/add-to-cart.php
A quick plugin to add a quantity to WooCommerce's 'add to cart' button
<?php
/**
* Plugin Name: WooCommerce XNum to cart
* Plugin URI: http://claudiosmweb.com/snippets/woocommerce-loop-de-produtos-com-quantidade/
* Source: http://docs.woothemes.com/document/override-loop-template-and-show-quantities-next-to-add-to-cart-buttons/
* Description: Add x-number of items feild to the 'add to cart' button in WooCommerce
* Version: .10
* Author: orionrush
* Note: You will have to style the button css according to your theme's needes.
*/
<?php
/**
* Custom Loop Add to Cart.
*
* Template with quantity.
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
/*
This widget shows Recent Posts on your Tumblr blog.
Its dependency is jQuery.
Usage:
1) Add html:
<div id="recent-posts"></div>
2) Add code into the <head>:
# ~/.osx — http://mths.be/osx
# root check
if [[ $EUID -ne 0 ]]; then
echo "################################";
echo "## YOU ARE NOT RUNNING AS ROOT #";
echo "################################";
echo "#";
echo "# USAGE: sudo $0";
exit;
//
// Alerts
// --------------------------------------------------
// Base styles
// -------------------------
.alert,
.validation_error,