Skip to content

Instantly share code, notes, and snippets.

Avatar

Curtis McHale curtismchale

View GitHub Profile
@curtismchale
curtismchale / edd-purchase-links-top-of-content.php
Created Jun 24, 2014
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
View edd-purchase-links-top-of-content.php
View meta-relation-or-query.php
<?php
function demo_shortcode(){
$args = array(
'post_type' => 'product',
'meta_query'=> array(
'relation' => 'OR',
array(
'key' => 'some_key',
'value' => '42',
'compare' => 'IN',
View gist:e7f78502ead52eab9b69
#bcit-todo-form input[type="submit"]{float:left; margin-right:10px;}
#bcit-todo-form #bcit_ajax_response{float:left;}
#bcit-todo-form #bcit_ajax_response .bcit-todo-ajax-spinner{display:none;}
#bcit-todo-form #bcit_ajax_response .response-message{float:left; display:inline-block;}
View check-requried.php
<?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
*
View wecr_restricted_content_message_cant_create_topics.php
<?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';
}
View wecr_restricted_content_message_logged_in_create_topics.php
<?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';
}
View wecr_restricted_content_message_global.php
<?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';
@curtismchale
curtismchale / wecr_allowed_post_types.php
Last active Aug 29, 2015
Adds a Custom Post Type called 'members_cpt' to the list of allowed post types.
View wecr_allowed_post_types.php
<?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;
View wecr_restricted_content_message_cant_reply.php
<?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';
}
View wecr_restricted_content_message_no_topics_found.php
<?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';
}