This file contains hidden or 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
| <?php | |
| /** | |
| * Enable comments for Courses and Lessons for members with access. | |
| * People who don't have access will only be able to view comments only. Great for upselling lessons and courses. | |
| * | |
| * To add this code to your site, follow this guide - https://www.paidmembershipspro.com/documentation/templates/customizing-via-a-custom-plugin/ | |
| */ | |
| function my_pmpro_courses_enable_comments( $open, $post_id ) { | |
| // Check if the person has access to the post type to comment. |
This file contains hidden or 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
| <?php | |
| /** | |
| * Removes the last "." from the level's cost text. | |
| * Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_remove_period_from_cost_text( $cost_text, $level, $tags, $short ) { | |
| return rtrim( $cost_text, '. ' ); | |
| } | |
| add_filter( 'pmpro_level_cost_text', 'my_pmpro_remove_period_from_cost_text', 10, 4 ); |
This file contains hidden or 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
| <?php | |
| /** | |
| * Allow <iframe> code in wp_kses_post calls. | |
| * Useful for embedding videos in Memberlite theme banner descriptions. | |
| * | |
| * Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_allow_iframe_wp_kses_post( $tags, $context ) { | |
| if ( 'post' === $context ) { |
This file contains hidden or 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
| <?php | |
| /** | |
| * Change the wording of the Prorations Downgrade Text. | |
| * Add this code to your site by following this guide - https://www.paidmembershipspro.com/documentation/templates/customizing-via-a-custom-plugin/ | |
| */ | |
| function my_pmpro_change_text( $translated_text, $text, $domain ) { | |
| if ( $domain == 'pmpro-proration' ) { | |
| if ( $text == 'Downgrading to %s on %s.' ) { | |
| $translated_text = 'Changing to %s on %s.'; // Adjust the wording here. | |
| } |
This file contains hidden or 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
| <?php | |
| /** | |
| * Remove all comments from HTML source (<!-- some comment -->) | |
| * Use at your own risk. | |
| * | |
| * To add customizations to your site, please follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| // Strip out HTML comments from the buffer. | |
| function my_pmpro_strip_html_comments( $buffer ) { |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;700&display=swap" rel="stylesheet"> | |
| <meta content="width=device-width, initial-scale=1.0" name="viewport"> | |
| <meta http-equiv="content-type" content="text-html; charset=utf-8"> | |
| <style type="text/css"> | |
| html, div, p, table { | |
| font-family: 'Noto Sans JP', sans-serif; | |
| } |
This file contains hidden or 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
| <?php | |
| // Example of using min and max input fields for date fields. | |
| function my_pmpro_add_user_fields() { | |
| // Don't break if PMPro is out of date or not loaded. | |
| if ( ! function_exists( 'pmpro_add_user_field' ) ) { | |
| return false; | |
| } | |
| // Store our field settings in an array. |
This file contains hidden or 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
| <?php | |
| /** | |
| * Shows membership level groups on the frontend profile page of the PMPro Membership Directory Add On. | |
| * Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_show_level_group_on_user_profile( $user ) { | |
| $levels = pmpro_getMembershipLevelsForUser( $user->ID ); | |
| if ( empty( $levels ) ) { |
This file contains hidden or 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
| <?php | |
| /** | |
| * Give access to admins to Addon Packages when "View As" is enabled. | |
| * | |
| * Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmproap_support_admin_view_as( $levels, $user_id, $post_id ){ | |
| if ( current_user_can( 'manage_options' ) ) { | |
| $view_as = get_user_meta( $user_id, 'pmpro_admin_membership_access', true ); |
This file contains hidden or 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
| <?php | |
| /** | |
| * Filter the subscription delay option for membership level ID 2 to be 1 year later if checking out in October. | |
| * Change "option_pmpro_subscription_delay_2" to "option_pmpro_subscription_delay_X" for a specific membership level. | |
| * | |
| * @see https://developer.wordpress.org/reference/hooks/option_option/ | |
| * | |
| * Add this custom code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_adjust_sub_delay_date( $value, $option ) { |
NewerOlder