Skip to content

Instantly share code, notes, and snippets.

View holisticnetworking's full-sized avatar
😎
Makin' teh codz.

Thomas Belknap holisticnetworking

😎
Makin' teh codz.
View GitHub Profile
@holisticnetworking
holisticnetworking / functions-filter-taxonomy.php
Created August 27, 2015 19:57
Filter posts (or CPTs) by a custom taxonomy in Admin.
function product_category_filter() {
global $typenow;
if ($typenow == 'product') :
$args = array(
'show_option_all' => "Show All Categories",
'taxonomy' => 'product_category',
'name' => 'product_category',
'value_field' => 'slug',
'selected' => !empty( $_GET['product_category'] ) ? $_GET['product_category'] : null
);
@holisticnetworking
holisticnetworking / print_sub_posts.php
Created September 2, 2015 23:52
WordPress. Loop through taxonomy (in this case, "menu") and list all sub-tax terms' posts.
/*
// For archives of taxonomies that allow them, this function will organize posts by
// the subterm of a term.
// var int $term_id: Not necessary for term archives, but for tax archives or other
// uses, this is the term you want to work with.
// var str $loop: Use this to specify a loop-$loop.php file. Defaults to the post type.
// var str $post_type: The correct post type to query for posts.
// var str $tax: The taxonomy to use.
//
*/
@holisticnetworking
holisticnetworking / horizontal-menus-foundation.php
Created September 24, 2015 19:07
Use Zurb Foundation to create horizontal menus.
register_sidebar( array(
'name' => __( 'Footer Widgets', 'reactive' ),
'id' => 'footer-widgets',
'description' => __( 'Large wells for the footer area', 'reactive' ),
'before_widget' => '<div id="%1$s" class="columns large-4 widget-container %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
@holisticnetworking
holisticnetworking / SassMeister-input.scss
Created October 24, 2015 18:16
Zurb Ink email template, Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
#outlook a {
padding:0;
}
body{
width:100% !important;
@holisticnetworking
holisticnetworking / gist:7217059
Created October 29, 2013 15:38
Sample object and call for WordPress' functions.php file:
class ParentFunctions {
function setup() {
// Cleverness goes here
}
/* Giddyup */
public function ParentFunctions() {
// Actions and filters:
add_action( 'after_setup_theme', array( &$this, 'setup' ) );
@holisticnetworking
holisticnetworking / gist:7217183
Created October 29, 2013 15:45
Extending the ParentFunctions class in a child theme.
class ChildFunctions extends ParentFunctions {
function setup() {
// No need to declare another name for this function, simple rewrite it as necessary
}
/* Giddyup */
public function ChildFunctions() {
parent::ParentFunctions();
}
}
@holisticnetworking
holisticnetworking / gist:8ef1156ecc63cd73b695
Created March 11, 2016 15:29
Use both Zurb Foundation 5 and 6 together by using aliases
alias foundation5='/usr/local/bin/foundation'
alias foundation6='/usr/bin/foundation'
[wp-tabbitygroup title="This is the Title for the layout. Leave this blank to not use it"]
[wp-tabbity title="Tab One"]Contents of Tab One[/wp-tabbity]
[wp-tabbity title="Tab Two"]Contents of Tab Two[/wp-tabbity]
[wp-tabbity title="Tab Three"]Contents of Tab Three[/wp-tabbity]
[/wp-tabbitygroup]
@holisticnetworking
holisticnetworking / payment-association.php
Last active November 2, 2016 18:25
Ok. Working with HABTM table. Payment Transactions belong to many Invoices. But trying to assign the association between a single payment and multiple invoices using the link() function doesn't seem to be working. Here is my code:
/*
* Apply Payments to Invoices
*/
public function applyPayments() {
$this->loadModel('PaymentMethods');
$invoices = $this->Invoices
->find( 'summary' )
->where([ 'Invoices.id IN' => $this->request->data( 'invoices' ) ]);
// Add totals:
/**
* Converts single-key metadata into multiple keys.
*
* @when before_wp_load
*/
$datagram_convert = function() {
$datagrams = WP_CLI::runcommand(
'post list --post_type=datagram --format=json',
[