Category: Archive
Display both published and modified date
MemberPress: Add Shortcode To Output the User’s Subscription Expiration Date
function mepr_sub_expiration_shortcode( $atts = [], $content = null, $tag = ” ) { $sub_expire_html = ”; if( $atts[‘membership’] && is_numeric( $atts[‘membership’] ) ) { $date_str = MeprUser::get_user_product_expires_at_date(get_current_user_id(), $atts[‘membership’]); if ( $date_str ) { $date = date_create( $date_str ); $sub_expire_html =…Continue reading
MemberPress: Extend the Grace Period
function mepr_extend_grace_period() { return 7; } add_filter( ‘mepr-grace-init-days’, ‘mepr_extend_grace_period’ );Continue reading
MemberPress: Remove the “Pause” Link for Subscriptions on the Account Page
function mepr_remove_pause_link( $output, $sub ) { if ( ’48’ == $sub->product_id ) { return; } return $output; } add_filter( ‘mepr_custom_pause_link’, ‘mepr_remove_pause_link’, 10, 2 );Continue reading
MemberPress: Display Account Tabs Anywhere
function mepr_account_links_shortcode() { $mepr_options = MeprOptions::fetch(); $account_url = $mepr_options->account_page_url(); $links = ‘ ‘; $links .= ‘ Home ‘; $links .= ‘ Subscriptions ‘; $links .= ‘ Payments ‘; $links .= ‘ Courses ‘; $links .= ‘ Logout ‘; $links .=…Continue reading
WPBakery Shortcode for the Post Excerpt with Limited Characters [vc_post_excerpt]
// WPBakery shortcode for the post excerpt with limited characters function vc_gitem_template_attribute_post_excerpt_with_link($value, $data) { extract(array_merge(array( ‘post’ => null, ‘data’ => ”, ), $data)); $excerpt = substr($post->post_content, 0, 150) . ‘…’; return ‘ ‘ . $excerpt . ‘ ‘; } add_filter(‘vc_gitem_template_attribute_vc_post_excerpt’,…Continue reading
WPBakery Shortcode for the Post Title with Limited Characters [vc_post_title]
// WPBakery shortcode for the post title with limited characters function vc_gitem_template_attribute_post_title_with_link($value, $data) { extract(array_merge(array( ‘post’ => null, ‘data’ => ”, ), $data)); $title = substr($post->post_title, 0, 70) . ‘…’; return ‘Continue reading
MemberPress: Set Custom Product Pages
function mepr_is_product_page( $return, $post ) { $custom_pages = array( 1, 2, 3 ); //Replace these numbers with the post ID’s of the pages if( isset( $post ) && in_array( $post->ID, $custom_pages ) ) { return true; } return $return; }…Continue reading
MemberPress: Disable Address Fields for a Specific Membership
function mepr_disable_address_fields( $fields ) { if ( is_single( array( 12, 564 ) ) ) { $hide_fields = array( ‘mepr-address-state’, ‘mepr-address-zip’, ‘mepr-address-one’, ‘mepr-address-two’, ‘mepr-address-city’, ‘mepr-address-country’, ); foreach ( $fields as $key => $field ) { if ( isset( $field->field_key ) &&…Continue reading