Skip to content

Instantly share code, notes, and snippets.

View michael-cannon's full-sized avatar

Michael Cannon michael-cannon

View GitHub Profile
@michael-cannon
michael-cannon / testimonials_widget_premium_form_options.php
Last active August 29, 2015 14:02
Add a field to Testimonials Premium
add_filter( 'testimonials_widget_cite_html', 'my_testimonials_widget_cite_html', 10, 3 );
function my_testimonials_widget_cite_html( $cite, $testimonial, $atts ) {
if ( ! empty( $testimonial['is-nurse'] ) ) {
$cite .= ', <b>' . $testimonial['is-nurse'] . '</b>';
}
return $cite;
}
@michael-cannon
michael-cannon / cbqe_page_sidebar.php
Last active August 29, 2015 14:02
Sidebar settings for Custom Bulk/Quick Edit Premium
<?php
/**
* Plugin Name: Sidebar for Custom Bulk/Quick Edit Premium
* Plugin URI: http://aihr.us/downloads/custom-bulkquick-edit-premium-wordpress-plugin/
* Author: Michael Cannon <mc@aihr.us>
*/
if ( ! class_exists( 'Custom_Bulkquick_Edit_Settings' ) ) {
return;
@michael-cannon
michael-cannon / tba_register_post_type_args.php
Created June 26, 2014 01:52
Filter tba_register_post_type_args
add_filer( 'tba_register_post_type_args', 'my_tba_register_post_type_args' );
function my_tba_register_post_type_args( $args ) {
$args['exclude_from_search'] = true;
return $args;
}
@michael-cannon
michael-cannon / aihrus_add_to_cart_item.php
Last active August 29, 2015 14:07
Modify the item being added to the cart during EDD Software License renewal. Why? A year ago, I offered a single, cheap unlimited license, but that's not a sustainable business model. Overtime, I raised the price and built up to 4 licensing levels. This script looks too see if a license renewal is happening and correct the pricing from unlimited…
<?php
add_filter( 'edd_add_to_cart_item', 'aihrus_add_to_cart_item' );
function aihrus_add_to_cart_item( $item ) {
if ( empty( $_GET['edd_license_key'] ) ) {
return $item;
} else {
$license = ! empty( $_GET['edd_license_key'] ) ? sanitize_text_field( $_GET['edd_license_key'] ) : false;
if ( ! $license ) {
return $item;
}
@michael-cannon
michael-cannon / cbqe-pilotpress.php
Last active August 29, 2015 14:08
Pilot Press integration for Custom Bulk/Quick Edit plugin
<?php
/**
* Pilot Press integration for Custom Bulk/Quick Edit plugin
*
* @author Michael Cannon <mc@aihr.us>
*/
add_filter( 'manage_post_posts_columns', 'rgp_manage_post_posts_columns' );
add_filter( 'manage_guitarlessons_posts_columns', 'rgp_manage_post_posts_columns' );
@michael-cannon
michael-cannon / cbqe-restrict-content-pro.php
Last active August 29, 2015 14:14
Restrict Content Pro for Custom Bulk/Quick Edit plugin
<?php
/**
* Restrict Content Pro for Custom Bulk/Quick Edit plugin
*
* In WordPress Admin > Settings > Custom Bulk/Quick, configure your fields as needed, per below. If configuration updates are needed, either manually edit them or remove the current field configuration and click Save Changes for automatic updates.
*
* Paid Only? - As checkbox
* Show Excerpt? - As checkbox
* Hide from Feed? - As checkbox
* Access Level - As RCP Access Level
<?php
/**
* @Author Anonymous
* @link http://www.redrokk.com
* @Package Wordpress
* @SubPackage RedRokk Library
*
* @version 2.0
*/
@michael-cannon
michael-cannon / gist:3028827
Created July 1, 2012 16:06
Scriblio plugin/class-facet-taxonomy.php - No matching_post_ids fix
Index: plugin/class-facet-taxonomy.php
===================================================================
--- plugin/class-facet-taxonomy.php (revision 566010)
+++ plugin/class-facet-taxonomy.php (working copy)
@@ -89,7 +89,7 @@
$cache_key = md5( serialize( $matching_post_ids ));
- if( ! $this->facets->_matching_tax_facets = wp_cache_get( $cache_key , 'scrib-facet-taxonomy' ))
+ if( ! empty( $matching_post_ids ) && ! $this->facets->_matching_tax_facets = wp_cache_get( $cache_key , 'scrib-facet-taxonomy' ))
@michael-cannon
michael-cannon / gist:3090584
Created July 11, 2012 14:09
Prevent doubly encoding UTF-8 content when incoming data could be UTF-8, ASCII or another character set
$recTitle = $record['title'];
$encoding = mb_detect_encoding( $recTitle, 'UTF-8', true );
if ( empty( $encoding ) ) {
$recTitle = mb_convert_encoding( $recTitle, 'UTF-8' );
}
@michael-cannon
michael-cannon / realurl.php
Created July 20, 2012 13:22
Default realurl configuration
<?php
$TYPO3_CONF_VARS['FE']['addRootLineFields'] .= ',tx_realurl_pathsegment,tx_realurl_exclude,tx_realurl_pathoverride,alias,nav_title,title';
// @ref http://www.slideshare.net/jweiland/why-realurl-sucks-and-how-to-fix-it
$realurlConfig = array(
'init' => array(
'adminJumpToBackend' => true,
'appendMissingSlash' => 'ifNotFile,redirect[301]',
'emptyUrlReturnValue' => '/',