Category: Archive
Add data-no-optimize to all JS snippets
add_filter( ‘wpcode_snippet_output_js’, function( $code ) { $code = str_replace( ‘’, ”, $code ); return $code; });Continue reading
Vertically center Instagram caption on hover
jQuery(window).on(‘sbiafterimagesloaded’, function (event) { $ = jQuery; $(‘.sbi_hover_top’).each(function(){ var $self = $(this); $self.css({ ‘position’ : ‘absolute’, ‘top’ : ( $self.parent().height() – $self.height() ) / 2 }); }); })Continue reading
MemberPress: Add Author Custom Bio Shortcode
function mpcs_author_custom_bio_shortcode( $atts ) { if( !isset( $atts[‘slug’] ) || empty( $atts[‘slug’] ) ) { return; } global $post; $field = get_user_meta( $post->post_author, $atts[‘slug’], true ); if( empty( $field ) ) { return; } return ‘ ‘ . sanitize_text_field( $field…Continue reading
MemberPress: Add Author Bio Shortcode
function mpcs_author_bio_shortcode() { return nl2br( get_the_author_meta( ‘description’ ) ); }; add_shortcode( ‘mpcs-author-bio’, ‘mpcs_author_bio_shortcode’ );Continue reading
MemberPress: Dynamic Trail Periods
function mepr_days_until( $date ){ return ( isset( $date ) ) ? floor( ( strtotime( $date ) – time() )/60/60/24 ) : false; } function mepr_update_mepr_trial_period() { $prd = new MeprProduct( 4480 ); //CHANGE 123 to the ID of your Membership…Continue reading
Add Visitor Type to the dataLayer
window.dataLayer = window.dataLayer || []; var email = ‘{email}’; dataLayer.push({ ‘visitorType’ : email.length > 0 ? ‘existingCustomer’ : ‘newCustomer’ });Continue reading
MemberPress: Change Stripe Payment Description
// For non-recurring function mepr_stripe_payment_descriptor( $args ){ $args[ ‘statement_descriptor’ ] = ‘Custom Descriptor’; // max 22 chars return $args; } add_filter( ‘mepr_stripe_payment_intent_args’, ‘mepr_stripe_payment_descriptor’, 10 );Continue reading
MemberPress: Return to Same Page After Signup
function mepr_cust_registration_input( $product_id ) { $post_id = url_to_postid( wp_get_referer() ); if( isset( $post_id ) && $post_id ) { $input_str = ““; echo $input_str; } } add_action( ‘mepr-checkout-before-submit’, ‘mepr_cust_registration_input’ ); function mepr_cust_thankyou_url_params( $url, $args ) { if ( isset( $_REQUEST[ ‘mepr_cust_current_page_id’…Continue reading
MemberPress: Move PayPal Smart Pay Buttons
//Alternatively, you can use the wp_head hook instead. Wp_footer works best if using ReadyLaunch(tm) function mepr_move_paypal_smart_buttons() { ?>Continue reading