Skip to content

Instantly share code, notes, and snippets.

INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@codelion7
codelion7 / mycred-hook-learndash
Created November 24, 2014 13:10
myCRED Custom Hook: LearnDash
/**
* Register Custom myCRED Hook
* @since 1.0
* @version 1.0
*/
add_filter( 'mycred_setup_hooks', 'Learndash_myCRED_Hook' );
function Learndash_myCRED_Hook( $installed ) {
$installed['hook_learndash'] = array(
'title' => __( 'LearnDash', 'mycred' ),
@gabrielmerovingi
gabrielmerovingi / mycred-woo-coupon
Last active June 28, 2020 15:19
This custom shortcode allows your users to convert their myCRED points into a WooCommerce coupon, in order to give themselves a discount or partial payment on their order. In order for this to work, you need to set an exchange rate between points and your store currency and select. Requires myCRED 1.6+ and WooCommerce 2.4+
/**
* Convert myCRED Points into WooCommerce Coupon
* Requires myCRED 1.4 or higher!
* @version 1.3.1
*/
add_shortcode( 'mycred_to_woo_coupon', 'mycred_pro_render_points_to_coupon' );
function mycred_pro_render_points_to_coupon( $atts, $content = NULL ) {
// Users must be logged in
if ( ! is_user_logged_in() )