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 / 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 / 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 / foreach-customize-settings.php
Last active July 8, 2017 03:19
Iterating over several related theme mods to create both their settings and their controls.
// Icon Fonts:
foreach( ReactiveCustomizer::$icon_fonts as $slug=>$name ) :
$wp_customize->add_setting( 'hn_icon_fonts_' . $slug , array(
'default' => '0'
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'icon_fonts_' . $slug, array(
'label' => __( $name, 'hn-reactive' ),
'section' => 'icon_fonts',
'settings' => 'hn_icon_fonts_' . $slug,
'type' => 'checkbox'
@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 / wp.responsive.images.php
Last active October 18, 2018 07:07 — forked from rezen/wp.filter.php
Filter Image insert for WordPress
public function hn_insert_image( $html, $id, $caption, $title, $align, $url ) {
$html5 = "<figure id='post-$id media-$id' class='align-$align'>";
$html5 .= "<img src='$url' alt='$title' />";
$html5 .= "<figcaption class="wp-caption">$caption</figcaption>";
$html5 .= "</figure>";
return $html5;
}
add_filter( 'image_send_to_editor', array( &$this, 'hn_insert_image' ), 10, 9 );
@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]