Skip to content

Instantly share code, notes, and snippets.

@wpsmith
wpsmith / custom-footer.php
Created April 28, 2012 23:41
Custom Footer
@wpsmith
wpsmith / home.php
Created April 29, 2012 17:09
Grid Home (focus)
<?php
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'focus_grid_loop_helper' );
/** Add support for Genesis Grid Loop */
function focus_grid_loop_helper() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 4,
@wpsmith
wpsmith / author_box_filter.php
Created May 2, 2012 12:37
Filter Author Box
<?php
add_filter( 'genesis_author_box', 'wps_author_box', 10, 6 );
/*
* Filters author box
*/
function wps_author_box( $output, $context, $pattern, $gravatar, $title, $description ) {
$pattern = $context == 'single' ? '<div class="author-box"><div>%s %s<br />%s<br />%s</div></div><!-- end .authorbox-->' : '<div class="author-box">%s<h1>%s</h1><div>%s<br />%s</div></div><!-- end .authorbox-->';
$link = ''; //HTML Markup
return sprintf( $pattern, $gravatar, $title, $description, $link );
@wpsmith
wpsmith / prepopulate_radio.php
Created May 25, 2012 21:25
Prepopulate Radios in Gravity Forms
<?php
// Filter is applied to all forms
//add_filter('gform_pre_render', 'wps_populate_person');
// Filter only applied to Form id = 3
add_filter('gform_pre_render_3', 'wps_populate_person');
/**
* Pre-populates radios based on previous name field
* Searches post type 'person'
@wpsmith
wpsmith / taxonomies.php
Created May 30, 2012 17:25
Registering Multiple Taxonomies
<?php
/**
* Taxonomies
*
* This file registers any custom taxonomies
*
* @package WPS_Starter_Genesis_Child
* @author Travis Smith <travis@wpsmith.net>
* @copyright Copyright (c) 2012, Travis Smith
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
@wpsmith
wpsmith / taxonomy_dropdown.php
Created June 1, 2012 18:42
Taxonomy Dropdown
<?php
/**
* Creates HTML markup for taxonomy dropdown
*
* @param string $taxonomy Registered taxonomy name
*/
function we_tax_dropdown( $taxonomy ) {
$terms = get_terms( $taxonomy );
$taxonomy = get_taxonomy( $taxonomy );
@wpsmith
wpsmith / global.js
Created June 29, 2012 04:20 — forked from jaredatch/global.js
Mobile Genesis menus
jQuery(document).ready(function($){
// Mobile navigation
$('#prim-selector, #sec-selector').change(function(){
if ($(this).val()!='') {
window.location.href=$(this).val();
}
});
});
@wpsmith
wpsmith / gist:3025182
Created June 30, 2012 19:29
wp_generate_attachment_metadata() Output
Array
(
[width] => 612
[height] => 792
[hwstring_small] => height='96' width='74'
[file] => 2012/lowercase-print-dn-letter-a-z.jpg
[sizes] => Array
(
[thumbnail] => Array
(
@wpsmith
wpsmith / attachment_metadata.php
Created June 30, 2012 19:36
Attachment Metadata Query
<?php
$args = array(
'post_status' => 'inherit', // Default status of attachments
'post_type' => array( 'attachment' ),
'meta_key' => '_wp_attachment_metadata',
'meta_value' => 'FinePix J10',
'meta_compare' => 'LIKE',
);
$attachment_query = new WP_Query( $args );
@wpsmith
wpsmith / wps_comment_form_args.php
Created July 17, 2012 14:56
Remove website field from Comments Form
<?php
add_filter( 'genesis_comment_form_args', 'wps_comment_form_args' );
/**
* Remove website field from Comments Form
*
* @param array $args Comments form arguments.
* @return array $args Modified Comments form arguments.
*/
function wps_comment_form_args( $args ) {
unset( $args['fields']['url'] );