This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Apply Default OG:Image for Jetpack | |
* When looking for images in posts that falls under "is_singular" | |
* and Jetpack does not find an image, we apply our own default image | |
* instead of the blank WordPress thumb. | |
* @version 1.0 | |
*/ | |
add_filter( 'jetpack_images_get_images', 'apply_default_image_for_jetpack_seo', 10, 3 ); | |
function apply_default_image_for_jetpack_seo( $media, $post_id, $args ) { | |
// Jetpack_PostImages::get_images did not find anything |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert myCRED Points into MarketPress Coupon | |
* @version 1.1 | |
*/ | |
add_shortcode( 'mycred_to_mpress_coupon', 'mycred_pro_render_points_to_marketpress_coupon' ); | |
function mycred_pro_render_points_to_marketpress_coupon( $atts, $content = NULL ) { | |
// Users must be logged in | |
if ( ! is_user_logged_in() ) | |
return 'You must be logged in to generate store coupons.'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* BP Checkins | |
* @requires myCRED 1.3 + | |
* @since 0.1 | |
* @version 1.0 | |
*/ | |
if ( class_exists( 'myCRED_Hook' ) && ! class_exists( 'myCRED_BP_Checkins' ) ) { | |
class myCRED_BP_Checkins extends myCRED_Hook { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Custom Shortcode: Limited Content Purchases | |
* Example WordPress shortcode to impose a maximum number of times | |
* a user can purchase a post in WordPress using the myCRED Sell Content add-on. | |
* Requires myCRED 1.4 or higher! | |
* @version 1.1 | |
*/ | |
add_shortcode( 'mycred_sell_this_limited', 'mycred_render_sell_this_limited' ); | |
function mycred_render_sell_this_limited( $atts, $content = NULL ) { | |
// First make sure we do not get an error if myCRED gets deactivated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'mycred_add', 'mycred_absolute_limit_for_comments', 20, 3 ); | |
function mycred_absolute_limit_for_comments( $reply, $request, $mycred ) { | |
// Ignore declined instances or instances that are not comment related | |
if ( $reply === false || $request['ref'] != 'approved_comment' ) return $reply; | |
// The user ID | |
$user_id = absint( $request['user_id'] ); | |
// Count the number of times this user has received points for comments. | |
$total = mycred_count_ref_instances( 'approved_comment', $user_id ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Unpublish users Posts | |
* If a user reaches or exceeds the minimum balance | |
* we unpublish all their posts. | |
* @version 1.0 | |
*/ | |
add_filter( 'mycred_add', 'mycred_unpublish_posts_on_minus', 999, 3 ); | |
function mycred_unpublish_posts_on_minus( $reply, $request, $mycred ) { | |
if ( $reply === false ) return; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* bbPress Give Points | |
* Allows admins to give points to topic authors. | |
* @version 1.0 | |
*/ | |
add_action( 'bbp_theme_after_reply_content', 'mycred_pro_insert_forum_buttons' ); | |
function mycred_pro_insert_forum_buttons() { | |
// Get Reply Author ID | |
$reply_author_id = bbp_get_reply_author_id( bbp_get_reply_id() ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Step 1 - Create custom Shortcode | |
* Creates a custom buyCRED shortcode that includes | |
* the marker attribute that is passed on to the gateway. | |
* @version 1.0 | |
*/ | |
add_shortcode( 'mycred_custom_buy', 'mycred_render_custom_buy_shortcode' ); | |
function mycred_render_custom_buy_shortcode( $atts, $title = 'Buy Points' ) { | |
if ( ! function_exists( 'mycred' ) ) return 'myCRED is not installed'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'mycred_add', 'enforce_mycred_form_limit', 10, 3 ); | |
function enforce_mycred_form_limit( $reply, $request, $mycred ) { | |
// First we only want to target form submissions | |
if ( $request['ref'] != 'contact_form_submission' ) ) | |
return $reply; | |
// If already declined by someone, horour it | |
if ( $reply !== true ) return $reply; | |
// Limit |
OlderNewer