Skip to content

Instantly share code, notes, and snippets.

View electricbrick's full-sized avatar

Tom Finley electricbrick

View GitHub Profile
@electricbrick
electricbrick / flexible-fields.php
Last active November 8, 2016 19:42
ACF Flexible Single Page Builder
/*---------------------------------------------------*/
/* Flexible Single Pages */
/*---------------------------------------------------*/
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array (
'key' => 'group_550f4c3fb623b',
'title' => 'Flexible Content',
'fields' => array (
@electricbrick
electricbrick / page_flexible.php
Created November 8, 2016 19:41
Genesis Flexible ACF Pages
<?php
/**
* Genesis Framework.
*
* WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
* Please do all modifications in the form of a child theme.
*
* @package Genesis\Templates
* @author StudioPress
* @license GPL-2.0+
@electricbrick
electricbrick / acf-ms-taxonomy-field-v5.php
Created October 6, 2016 15:11
ACF Multisite Taxonomy Field (5.0+)
<?php
class acf_ms_taxonomy extends acf_field
{
/*
* __construct
*
* This function will setup the field type data
*
@electricbrick
electricbrick / acf-ms-taxonomy-field-v4.php
Last active October 6, 2016 15:10
ACF Multisite Taxonomy Select (4.0 and lower)
<?php
class acf_ms_taxonomy extends acf_field
{
var $defaults;
/*
* __construct
@electricbrick
electricbrick / Contract Killer 3.md
Created August 15, 2016 16:14 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@electricbrick
electricbrick / functions.php
Last active July 29, 2016 17:26 — forked from srikat/functions.php
Related Posts with Thumbnails in Genesis with fix for removing duplicate Posts. https://sridharkatakam.com/related-posts-with-thumbnails-in-genesis-reloaded/
add_action( 'genesis_before_comments', 'sk_related_posts', 12 );
/**
* Outputs related posts with thumbnail
*
* @author Nick the Geek
* @url http://designsbynickthegeek.com/tutorials/related-posts-genesis
* @global object $post
*/
function sk_related_posts() {
@electricbrick
electricbrick / gist:e93b2c3eff30e0ee94d3ded11fec00d9
Created June 10, 2016 20:44
WordPress Advanced Custom Field (ACF) - Conditional Checkboxes with Labels as Output (with option of Values as URLs)
//* Program Locations
$program_locations = get_field( 'program_locations' );
if ( $program_locations ) {
echo '<section class="location-widget widget widget_text"><div class="wrap widget-wrap">';
echo '<h4 class="widget-title widgettitle">Program Locations</h4>';
$field = get_field_object('program_locations');
@electricbrick
electricbrick / gist:908d182fc7f010f03962e53407614b40
Created June 10, 2016 20:42
WordPress Advanced Custom Field (ACF) - Repeater with Conditional Subfields
//* Program Faculty
$faculty = get_field('faculty_listing');
if( have_rows('faculty_listing') ) :
echo '<section class="row" id="faculty"><div class="wrap"><h4>Faculty</h4><div class="faculty">';
while( have_rows('faculty_listing') ): the_row();
@electricbrick
electricbrick / su-multiple-post-thumbs.php
Created October 30, 2015 16:03
SU Multiple Post Thumbnails
//* Featured Events Secondary Featured Image
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(array(
'label' => 'Featured Image 2',
'id' => 'featured-image-2',
'post_type' => 'su_feat_events'
) );
}
@electricbrick
electricbrick / gsfw-targeted-instance.php
Last active October 13, 2015 16:40
Genesis Sandbox Featured Content Widget - Targeted Instance
//* Add "See All Videos" Link to Featured Videos
add_action( 'wp_head', 'target_gs_ftd' );
function target_gs_ftd() {
if ( is_active_widget( true, 'featured-content-3', 'featured-content', true ) ) {
add_filter( 'gsfc_after_loop', 'featured_content_3' );
function featured_content_3( $instance ) {
if ( 3 != $instance['custom_field'] ) {
return;
}
echo '<div class="more-wrapper"><a href="http://www.su.app/shenandoah-today/videos/">See All Videos</a></div>';