Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@billerickson
billerickson / 0_reuse_code.js
Created June 4, 2014 13:29
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
//* Add sorting buttons
add_action('genesis_before_loop', 'ac_sort_buttons');
function ac_sort_buttons() {
echo '<p>';
echo 'Sort:';
echo '<a href="?sort=oldest">Oldest</a>';
echo '<a href="?sort=alpha">Alphabetical</a>';
<?php
/**
* Metaboxes
*
* This file registers any custom metaboxes
*
* @package Core_Functionality
* @since 1.0.0
* @link https://github.com/billerickson/Core-Functionality
* @author Bill Erickson <bill@billerickson.net>
<?php
/** Add Project Information After Content */
add_action ( 'genesis_sidebar', 'mmi_sing_project_side' );
function mmi_sing_project_side() {
echo '<div class="mmi-sidebar">';
echo '<section class="widget">';
echo '<h4 class="widgettitle">Participate In This Project</h4>';
$participants = get_post_meta(get_the_ID(), 'participants_needed', false);
@billerickson
billerickson / functions.php
Last active December 17, 2015 18:59 — forked from jamiemitchell/taxonomy-product_category.php
Use the main loop, not a custom loop. Customize the loop parameters using 'pre_get_posts' in functions.php.
<?php
/**
* Customize Product Category Query
* @link http://www.billerickson.net/customize-the-wordpress-query/
*/
function be_product_category_query( $query ) {
if( $query->is_main_query() && !is_admin() && $query->is_tax( 'product-category' ) ) {
$query->set( 'orderby', 'title' );
<?php
add_action( 'genesis_before_loop', 'child_maybe_do_grid_loop' );
function child_maybe_do_grid_loop() {
// Amend this conditional to pick where this grid looping occurs
if ( is_page('2') ) {
remove_action('genesis_before_post_content', 'genesis_post_info');
@billerickson
billerickson / custom_grid_loop_content.php
Created October 9, 2012 23:25
Customizing Grid Loop Content
/** Customize Blog Post Content */
function atb_test( $content ) {
global $post;
if( ! ( in_array( 'feature', get_post_class() ) || in_array( 'one-third', get_post_class() ) )
return $content;
// First Page Classes
if( ! $wp_query->query_vars['paged'] ) {
// Features
@billerickson
billerickson / gist:3714550
Created September 13, 2012 14:09 — forked from anonymous/gist:3712088
Sample Child Theme with Post Format
<?php
/** Start the engine */
require_once( get_template_directory() . '/lib/init.php' );
/** Child theme (do not remove) */
define( 'CHILD_THEME_NAME', 'Sample Child Theme' );
define( 'CHILD_THEME_URL', 'http://www.studiopress.com/themes/genesis' );
/** Add Viewport meta tag for mobile browsers */
add_action( 'genesis_meta', 'add_viewport_meta_tag' );
@billerickson
billerickson / gist:3698476
Last active February 23, 2024 16:49 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@billerickson
billerickson / genesis-custom-loop-pagination.php
Created July 31, 2012 15:59
Genesis custom loop with pagination
<?php
/* Template Name: Test */
/**
* Genesis custom loop
*/
function be_custom_loop() {
global $post;
// arguments, adjust as needed