Skip to content

Instantly share code, notes, and snippets.

Bill Erickson billerickson

Block or report user

Report or block billerickson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:3698476
<?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 Jul 31, 2012
Genesis custom loop with pagination
View genesis-custom-loop-pagination.php
<?php
/* Template Name: Test */
/**
* Genesis custom loop
*/
function be_custom_loop() {
global $post;
// arguments, adjust as needed
@billerickson
billerickson / gist:2047229
Last active Dec 20, 2019
Improve performance of WP_Query
View gist:2047229
<?php
$args = array(
// Normal query goes here //
'no_found_rows' => true, // counts posts, remove if pagination required
'update_post_term_cache' => false, // grabs terms, remove if terms required (category, tag...)
'update_post_meta_cache' => false, // grabs post meta, remove if post meta required
);
@billerickson
billerickson / functions.php
Last active Oct 14, 2019
[display-posts post_type="ai1ec_event"]
View functions.php
<?php
/**
* Display Posts - All in One Event Calendar
* @see https://wordpress.org/support/topic/support-for-all-in-one-event-calendar/
*
* @param array $args, query arguments
* @param array $atts, shortcode attributes
* @return array $args, modified query arguments
*/
@billerickson
billerickson / gist:1209601
Created Sep 11, 2011
Add custom fields to Display Posts Shortcode
View gist:1209601
<?php
/**
* Add custom fields to Display Posts Shortcode
* @author Bill Erickson
* @link http://wordpress.org/extend/plugins/display-posts-shortcode/
* @link http://www.billerickson.net/shortcode-to-display-posts/comment-page-1/#comment-4565
*
* @param $output string, the original markup for an individual post
* @param $atts array, all the attributes passed to the shortcode
* @param $image string, the image part of the output
View general.php
<?php
/**
* General
*
* This file contains any general functions
*
* @package Core_Functionality
* @since 1.0.0
* @link https://github.com/billerickson/Core-Functionality
* @author Bill Erickson <bill@billerickson.net>
@billerickson
billerickson / gist:1888923
Created Feb 23, 2012
Popular Posts Widget
View gist:1888923
<?php
/**
* Popular Posts Widget
*
* Displays posts in last X days, sorted by most comments (proxy for popularity)
*
* @package Core Functionality
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
View gist:1717547
<?php
add_action( 'genesis_after_header', 'be_change_sidebar_order' );
/**
* Swap Primary and Secondary Sidebars on Sidebar-Sidebar-Content
*
* @author Bill Erickson
* @link http://www.billerickson.net/switch-genesis-sidebars/
*/
function be_change_sidebar_order() {
View .gitignore
# Ignore everything #
**
!wp-content/
wp-content/**
!wp-content/themes/
!wp-content/plugins/
wp-content/themes/**
wp-content/plugins/**
# Add two rules for each Theme or Plugin you want to include:
View plugin.php
<?php
/**
* Don't Update Plugin
*
* This prevents you being prompted to update if there's a public plugin
* with the same name.
*
* @since 1.0.0
* @author Mark Jaquith
You can’t perform that action at this time.