Skip to content

Instantly share code, notes, and snippets.

View electricbrick's full-sized avatar

Tom Finley electricbrick

View GitHub Profile
@electricbrick
electricbrick / gist:6455575
Created September 5, 2013 20:17
Daily Specials Code
<?php
/**
* Template Name: Daily Specials
* Description: Used as a page template to show page contents, followed by a loop through a CPT archive
*/
remove_action('genesis_loop', 'genesis_do_loop');
add_action('genesis_loop', 'custom_do_cat_loop');
/** Remove Post Info */
@electricbrick
electricbrick / gist:7089937
Created October 21, 2013 19:59
Genesis Page/Post Hybrid with Shortcode Execution after both loops.
<?php
/**
*
* Template Name: Hybrid Template
* This file handles blog post listings within a page.
*
*/
add_action('genesis_loop', 'custom_do_cat_loop');
@electricbrick
electricbrick / gist:7106139
Created October 22, 2013 18:58
Tonight's Menu
<?php
/**
* Template Name: Tonight's Menu
* Description: Used as a page template to show page contents, followed by a loop through a CPT archive
*/
remove_action('genesis_loop', 'genesis_do_loop');
add_action('genesis_loop', 'custom_do_cat_loop');
/** Remove Post Info */
@electricbrick
electricbrick / gist:65bbd2dc0a660a06b5e7
Created June 3, 2014 15:31
Genesis 2.0 Conditional CSS for Internet Explorers 7 & 8
//* Conditional CSS
add_action( 'wp_enqueue_scripts', 'child_add_ie8_style_sheet', 200 );
function child_add_ie8_style_sheet() {
global $wp_styles;
wp_enqueue_style( 'child-ie8', get_stylesheet_directory_uri() . '/style-ie8.css', array(), '1.0' );
$wp_styles->add_data( 'child-ie8', 'conditional', 'lte IE 8' );
}
add_action( 'wp_enqueue_scripts', 'child_add_ie7_style_sheet', 200 );
function child_add_ie7_style_sheet() {
<?php
/**
* Faculty Archive
*
*/
# Force full width content
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
<?php
/**
* Faculty Archive
*
*/
# Force full width content
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
@electricbrick
electricbrick / has-child-or-parent.php
Created June 26, 2014 18:32
If current taxonomy has child and/or parent
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); // get current term
$parent = get_term($term->parent, get_query_var('taxonomy') ); // get parent term
$children = get_term_children($term->term_id, get_query_var('taxonomy')); // get children
if(($parent->term_id!="" && sizeof($children)>0)) {
// has parent and child
<?php
/**
* Faculty Archive
*
*/
add_action('genesis_meta', 'faculty_styles');
function faculty_styles() {
wp_enqueue_style( 'faculty-css', get_stylesheet_directory_uri() . '/css/faculty.css');
@electricbrick
electricbrick / taxonomy-department.php
Created July 10, 2014 15:51
Faculty Taxonomy Template
<?php
/**
* Template Name: Departmental Taxonomy Template
*
*
* @category faculty
* @package Templates
* @author Thomas Finley <tfinley@su.edu>
* @copyright Copyright (c) 2014, Shenandoah University
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
@electricbrick
electricbrick / faculty.php
Created July 11, 2014 14:11
Faculty Custom Post Type for WordPress
<?php
/*
Plugin Name: Faculty Custom Post Type
Description: Adds custom post types for faculty members
Version: 0.1
License: GPL
Author: Oli Dale
Author URI: http://wplift.com
*/