Skip to content

Instantly share code, notes, and snippets.

@wpsmith
wpsmith / user_query.php
Created August 15, 2012 17:50
Basic Use of WP_User_Query
<?php
// prepare arguments
$args = array(
'orderby' => 'display_name', // Order by display name
'exclude' => array( 2, 5, ), // Remove the two main admins
);
// Create the WP_User_Query object
@wpsmith
wpsmith / user_query.php
Created August 15, 2012 17:56
Get all Users who are not authors
<?php
// prepare arguments
$args = array(
'role' => 'author',
'query_id' => 'wps_not_author',
'meta_query' => array(
array(
'key' => 'wpsand_capabilities',
'value' => '"author"',
@wpsmith
wpsmith / user_query.php
Created August 15, 2012 18:26
Get all Users who are not editors or administrators
<?php
// prepare arguments
$args = array(
'role' => 'author',
'query_id' => 'wps_not_author',
'meta_query' => array(
array(
'key' => 'wpsand_capabilities',
'value' => '"editor"',
@wpsmith
wpsmith / shopp_referrer.php
Created August 16, 2012 13:46
Shopp Referrer
<?php
/*
* Gets previous page
*
* If the previous page is a page outside the site, returns the storefront page.
*
* @param $args array Optional Args
* @return $referrer string
*/
@wpsmith
wpsmith / endpoints.php
Created August 16, 2012 15:33
Mutliple Taxonomy Endpoints
<?php
add_action( 'init', 'wps_lords_add_endpoints', 15 );
/**
* Lord's Endpoint addition for Manufacturer and Category Combination
*
* @uses add_permastruct()
* @uses add_rewrite_rule()
*/
function wps_lords_add_endpoints() {
@wpsmith
wpsmith / footer-widgets-height.js
Created August 18, 2012 01:20
JS: Resizes Genesis Footer Widgets to Equal Heights (responsively)
@wpsmith
wpsmith / functions.php
Created August 18, 2012 01:39 — forked from billerickson/functions.php
Add "Email Us" link to footer
<?php
/**
* Add "Email Us" link to footer
*
* @author Bill Erickson
* @author Travis Smith (modified)
* @link http://www.billerickson.net/overriding-options-and-meta
*/
function be_email_us() {
@wpsmith
wpsmith / shopp_create_promo.php
Created August 27, 2012 20:25
Creates a Shopp Promotion
/**
* Creates a Shopp Promotion.
*
* $defaults = array(
* // Enable the promo
* 'status' => 'enabled',
*
* // DATES
* 'starts' => array(
* 'month' => '',
@wpsmith
wpsmith / wps_child_script.php
Created August 29, 2012 15:53
Enqueues Appropriate Scripts when needed based on Debugging.
<?php
add_action( 'wp_enqueue_scripts', 'wps_child_script' );
/**
* Enqueues Appropriate Scripts when needed based on Debugging.
* Assumes that the normal *.js is the minified version & *-dev.js is beautified version.
*
* @uses wp_enqueue_script() WP adds JS to page safely.
* @uses WP_DEBUG Constant: Triggers "debug" mode throughout WordPress
@wpsmith
wpsmith / child_nav_menu_args.php
Created September 7, 2012 01:56
Modifies the Navigation Menu based on current user capabilities
add_filter( 'wp_nav_menu_args', 'child_nav_menu_args' );
/**
* Modifies the Navigation Menu based on current user capabilities
*
* @uses gbootstrap_nav_args() Sets Genesis Bootstrap Navigation Args for wp_nav_menu().
* @param array $args Arguments for wp_nav_menu()
* @return array $args Modified Arguments for wp_nav_menu()
* @since 1.0.0
*/
function child_nav_menu_args( $args ) {