Skip to content

Instantly share code, notes, and snippets.

View curtismchale's full-sized avatar

Curtis McHale curtismchale

View GitHub Profile
<?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
*/
<?php
/**
* Registers and enqueues scripts and styles
*
* @uses wp_enqueue_style
* @uses wp_enqueue_script
*
* @since 1.0
* @author SFNdesign, Curtis McHale
*/
<?php
/**
* Overrides the default message for subscription type products
*
* @param string $message stock Easy Content Restriction message
* @param int $product_id The post_id for the product the message would be tied to
* @return string Your custom message
*/
function change_subscription_message( $message, $product_id ) {
return 'Our custom message';