Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Cannon michael-cannon

View GitHub Profile
View style.css
/*
Theme Name: Organic-NonProfit
Theme URL: http://www.organicthemes.com/
Description: Organic Themes offers professionally designed, highly customizable Wordpress themes.
Author: Organic Themes
Author URI: http://www.organicthemes.com
Version: 1.3.1
Tags: organic themes, wordpress customization
The CSS, XHTML and Design are released under the GPL:
@michael-cannon
michael-cannon / gist:5517959
Last active Dec 16, 2015
[testimonialswidget_list limit=1 random=true paging=false]
View gist:5517959
[testimonialswidget_list limit=1 random=true paging=false]
<div class="testimonials-widget-testimonials listing"><div class="post-15380 testimonials-widget type-testimonials-widget status-publish hentry testimonials-widget-testimonial single even"><span class="image"><img width="150" height="150" src="http://wp.localhost/wp-content/uploads/2013/01/winterbournedesign.jpeg" class="attachment-thumbnail wp-post-image" alt="winterbournedesign" /></span><blockquote><p><span class="open-quote"></span>Thanks for the fast reply Michael! Have a great weekend.<span class="close-quote"></span></p></blockquote><div class="credit"><span class="author"><a href="http://wordpress.org/support/profile/winterbournedesign" rel="nofollow">Winterbourne Design</a></span></div></div></div>
<div class="testimonials-widget-testimonials listing"><div class="post-15261 testimonials-widget type-testimonials-widget status-publish hentry testimonials-widget-testimonial single"><span class="image"><img width="150" height="150" src="http://w
@michael-cannon
michael-cannon / functions.php
Created May 12, 2013
Work around for Easy Digital Downloads Payment History report for showing account username than guest after using EDD Guest Registration to convert a guest account to real.
View functions.php
function dc_edd_get_payment_meta( $meta, $payment_id ) {
if ( -1 == $meta['user_id'] ) {
$user_id = get_post_meta( $payment_id, '_edd_payment_user_id', true );
$meta['user_id'] = $user_id;
$user_info = maybe_unserialize( $meta['user_info'] );
$user_info['id'] = $user_id;
$meta['user_info'] = serialize( $user_info );
}
@michael-cannon
michael-cannon / functions.php
Created May 13, 2013
Add recurring period to pricing
View functions.php
<?php
add_filter( 'edd_purchase_download_form', 'aihrus_edd_purchase_download_form', 10, 2 );
function aihrus_edd_purchase_download_form( $purchase_form, $args ) {
$id = $args['download_id'];
$price = edd_get_download_price( $id );
if ( 0 == $price ) {
$price = '&#036;' . $price;
$replace = 'Free';
$purchase_form = str_replace( $price, $replace, $purchase_form );
} elseif ( class_exists( 'EDD_Recurring' ) && EDD_Recurring()->is_recurring( $id ) ) {
@michael-cannon
michael-cannon / quick_edit.js
Last active Apr 15, 2020
Working WordPress bulk and quick edit example for a video custom post type. http://aihr.us/wordpress/working-examples-for-wordpress-bulk-and-quick-edit/
View quick_edit.js
// @ref http://rachelcarden.com/2012/03/manage-wordpress-posts-using-bulk-edit-and-quick-edit/
(function($) {
// we create a copy of the WP inline edit post function
var $wp_inline_edit = inlineEditPost.edit;
// and then we overwrite the function with our own code
inlineEditPost.edit = function( id ) {
// "call" the original WP edit function
// we don't want to leave WordPress hanging
$wp_inline_edit.apply( this, arguments );
@michael-cannon
michael-cannon / testimonials_widget_testimonial_html_single_content.php
Created Jun 21, 2013
filter testimonials_widget_testimonial_html_single_content example
View testimonials_widget_testimonial_html_single_content.php
add_filter( 'testimonials_widget_testimonial_html_single_content', array( &$this, 'testimonials_widget_testimonial_html_single_content' ), 10, 3 );
public function testimonials_widget_testimonial_html_single_content( $content, $testimonial, $atts ) {
$atts = wp_parse_args( $atts, Testimonials_Widget::get_defaults( true ) );
$atts = Testimonials_Widget_Settings::validate_settings( $atts );
$hide_excerpt = $atts['hide_excerpt'];
$excerpt = '';
if ( empty( $hide_excerpt ) && ! empty( $testimonial['testimonial_excerpt'] ) ) {
@michael-cannon
michael-cannon / testimonials_widget_testimonials_js.php
Created Jun 21, 2013
Filter testimonials_widget_testimonials_js example
View testimonials_widget_testimonials_js.php
add_filter( 'testimonials_widget_testimonials_js', array( &$this, 'next_testimonial' ), 10, 4 );
public function next_testimonial( $scripts, $testimonials, $atts, $widget_number ) {
$next_button = $atts['next_button'];
$refresh_interval = $atts['refresh_interval'];
if ( $next_button ) {
$id = Testimonials_Widget::ID;
$id_base = $id . $widget_number;
$key = "nextTestimonial{$widget_number}";
@michael-cannon
michael-cannon / testimonials_widget_cache_.php
Last active Dec 18, 2015
Filter testimonials_widget_cache_get and testimonials_widget_cache_set example
View testimonials_widget_cache_.php
add_filter( 'testimonials_widget_cache_get', array( $this, 'cache_get' ) );
add_filter( 'testimonials_widget_cache_set', array( $this, 'cache_set' ), 10, 2 );
public static function cache_get( $args ) {
$hash = self::create_hash( $args );
$do_cache = apply_filters( 'testimonials_widget_disable_cache', true );
$no_cache = isset( $args['no_cache'] ) && Testimonials_Widget_Settings::is_true( $args['no_cache'] );
if ( ! $do_cache || $no_cache ) {
delete_transient( $hash );
return false;
}
@michael-cannon
michael-cannon / testimonials_widget_columns.php
Created Jun 21, 2013
Filter testimonials_widget_columns example
View testimonials_widget_columns.php
add_filter( 'testimonials_widget_columns', array( &$this, 'columns' ) );
public function columns( $columns ) {
$columns['testimonials-widget-read-more-link'] = __( 'Read More Link', 'testimonials-widget-premium' );
return $columns;
}
@michael-cannon
michael-cannon / testimonials_widget_content.php
Created Jun 21, 2013
Filter testimonials_widget_content example
View testimonials_widget_content.php
add_filter( 'testimonials_widget_content', array( &$this, 'truncate_content' ), 10, 4 );
public function truncate_content( $content, $widget_number, $source, $atts ) {
$char_limit = $atts['char_limit'];
$excerpt_read_more = $atts['excerpt_read_more'];
$force_read_more = $atts['force_read_more'];
$hide_read_more = $atts['hide_read_more'];
$nofollow_read_more = $atts['nofollow_read_more'];
$content_bare = strip_tags( $content );
if ( ! $force_read_more ) {