Skip to content

Instantly share code, notes, and snippets.

View curtismchale's full-sized avatar

Curtis McHale curtismchale

View GitHub Profile
@curtismchale
curtismchale / edd-purchase-links-top-of-content.php
Created June 24, 2014 17:36
Moves the EDD Purchase button (and variations) to the top of the content instead of placing it at the bottom. Removes the original purchase links so they don't show up twice. Blogged: http://wp.me/p1Fud2-1of June 26, 2014
<?php
function demo_shortcode(){
$args = array(
'post_type' => 'product',
'meta_query'=> array(
'relation' => 'OR',
array(
'key' => 'some_key',
'value' => '42',
'compare' => 'IN',
<?php
// hooked inside a class for my normal dev work
add_action( 'admin_notices', 'check_required_plugins' );
/**
* Checks for WooCommerce and kills our plugin if it isn't active
*
* @uses function_exists Checks for the function given string
* @uses deactivate_plugins Deactivates plugins given string or array of plugins
*
@curtismchale
curtismchale / wecr_allowed_post_types.php
Last active August 29, 2015 14:03
Adds a Custom Post Type called 'members_cpt' to the list of allowed post types.
<?php
/**
* Adds the custom post type 'members_cpt' to the list of post types allowed
*
* @param array $allowed Existing array of allowed CPT's
* @return array $allowed Modified array of allowed CPT's
*/
function add_members_cpt( $allowed ){
$allowed[] = 'members_cpt';
return $allowed;
<?php
/**
* Allows you to filter the stock bbPress message that reads 'You cannot reply to this topic:'
*
* @param string $message stock Easy Content Restriction message
* @return string Your custom message
*/
function change_cant_reply_message( $message ) {
return 'Our custom message';
}
<?php
/**
* Allows you to filter the stock bbPress message that reads 'Oh bother! No topics were found here!'
*
* @param string $message stock Easy Content Restriction message
* @return string Your custom message
*/
function change_no_topics_message( $message ) {
return 'Our custom message';
}
<?php
/**
* Allows you to filter the stock bbPress message that reads 'You cannot create new topics at this time.'
*
* @param string $message stock Easy Content Restriction message
* @return string Your custom message
*/
function change_cant_create_topics_message( $message ) {
return 'Our custom message';
}
<?php
/**
* Allows you to filter the stock bbPress message that reads 'You must be logged in to create new topics.'
*
* @param string $message stock Easy Content Restriction message
* @return string Your custom message
*/
function change_logged_in_topic_message( $message ) {
return 'Our custom message';
}
<?php
/**
* Allows you to override any custom message or the default message for users
*
* @param string $message stock Easy Content Restriction message
* @param int $product_ids The post_id array for the product the message would be tied to
* @return string Your custom message
*/
function change_global_message( $message, $product_ids ) {
return 'Our custom message';
<?php
/**
* Abstracting the featured Ads Query so that we don't have to retype it all over
*
* @class WP_Query
* @uses wp_parse_args
*
* @since 1.0
* @author SFNdesign, Curtis McHale
*/