Skip to content

Instantly share code, notes, and snippets.

View pippinsplugins's full-sized avatar

Pippin Williamson pippinsplugins

View GitHub Profile
@pippinsplugins
pippinsplugins / Filter Events
Created June 29, 2012 14:40 — forked from stompweb/filter-events.php
Filter events pre_get_posts
// Function to display only upcoming events for Sugar Events Calendar on the main Events archive.
function sc_filter_events( $query ) {
if( is_post_type_archive('sc_event') && (!is_admin()) ) {
$meta = array(
array(
'key' => 'sc_event_date_time',
'value' => time(),
@pippinsplugins
pippinsplugins / wrapper.php
Created July 17, 2012 00:02 — forked from anointed/finished.php
Filter to apply a div before menu output
<?php
function tumble_menu( $args = array() ) {
/* Default arguments */
$defaults = array(
'container' => 'ul',
'menu_class' => 'nav',
'menu_id' => 'top_nav',
'theme_location' => 'top-menu',
'echo' => false,
'before' => '',
@pippinsplugins
pippinsplugins / gist:3489713
Created August 27, 2012 15:50 — forked from rezzz-dev/gist:3489697
Add a checkbox to Taxonomy
// Edit term page
function summit_taxonomy_edit_meta_field($term) {
// put the term ID into a variable
$t_id = $term->term_id;
// retrieve the existing value(s) for this meta field. This returns an array
$term_meta = get_option( "taxonomy_$t_id" ); ?>
<tr class="form-field">
<th scope="row" valign="top"><label for="term_meta[displayed]"><?php _e( 'Display Category', 'summit' ); ?></label></th>
function jc_paged_posts_columns() {
echo '<div id="paged-columns">';
global $post;
$numposts = 11;
$args = array( 'numberposts' => $numposts, 'offset' => 10 );
$column1 = get_posts( $args );
echo '<ul class="column-list">';
echo '<li class="column-heading">Page 2</li><ol>';
foreach ( $column1 as $post ) : setup_postdata($post); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
@pippinsplugins
pippinsplugins / EDD Add to Cart Checkout
Created September 8, 2012 02:46 — forked from bryceadams/EDD Add to Cart + Checkout
Easy Digital Downloads - Add to Cart and redirect to Checkout Page
<a href="<?php echo add_query_arg( array( 'edd_action' => 'add_to_cart', 'download_id' => get_the_ID() ), edd_get_checkout_uri() ); ?>">Add to Cart</a>
@pippinsplugins
pippinsplugins / class.php
Created September 27, 2012 14:46 — forked from fxbenard/class.php
How to make it i18n without error ?
private $defaultCapabilities = array(
'connections_view_dashboard' => __('View Dashboard', 'your-domain'),
'connections_manage' => __('View List (Manage)', 'your-domain'),
'connections_add_entry' => __('Add Entry', 'your-domain'),
'connections_add_entry_moderated' => __('Add Entry Moderated', 'your-domain'),
'connections_edit_entry' => __('Edit Entry', 'your-domain'),
'connections_edit_entry_moderated' => __('Edit Entry Moderated', 'your-domain'),
'connections_delete_entry' => __('Delete Entry', 'your-domain'),
'connections_view_public' => __('View Public Entries', 'your-domain'),
'connections_view_private' => __('View Private Entries', 'your-domain'),
@pippinsplugins
pippinsplugins / edd_get_purchase_id_by_key.php
Created October 27, 2012 21:17 — forked from jdevalk/edd_get_purchase_id_by_key.php
Retrieve the purchase ID based on the purchase key
<?php
/**
* Retrieve the purchase ID based on the purchase key
*
* @access public
* @since 1.2.3
*
* @param string $key the purchase key to search for
* @return int $order_id
*/
@pippinsplugins
pippinsplugins / gist:5788774
Last active December 18, 2015 13:19 — forked from markjaquith/gist:2653957
Modified version of Mark's class that includes a flush() member function.
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
// make downloads hierarchical
function thesrpr_edd_make_hierarchical($download_args ) {
$download_args['hierarchical'] = true;
return $download_args;
}
add_filter( 'edd_download_post_type_args', 'thesrpr_edd_make_hierarchical' );
<?php
/**
* Plugin Name: Update Previous Order Numbers for EDD
* Description: For users of the sequential order number beta, use this before you get new orders to have your previous orders sequentially numbered
* Version: 0.1
* Author: Chris Christoff
* Author URI: http://www.chriscct7.com
*/
function update_script_edd_seq_numbers(){