Skip to content

Instantly share code, notes, and snippets.

View kimcoleman's full-sized avatar

Kim Coleman kimcoleman

View GitHub Profile
@kimcoleman
kimcoleman / pmpro-no-access.css
Created November 1, 2021 17:12
Custom CSS to blur excerpt text on premium content previews with Paid Memberships Pro
.pmpro-no-access p {
-webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0), rgba(0, 0, 0, .5));
}
@kimcoleman
kimcoleman / demo_sites_grid_shortcode.php
Created September 27, 2021 10:40
Shortcode to show a grid of all demo sites with featured image in the network.
<?php
/**
* Shortcode to show a grid of all demo sites with featured image in the network.
*
*/
function demo_sites_grid_shortcode( ) {
ob_start();
$subsites = get_sites();
if ( ! empty ( $subsites ) ) {
@kimcoleman
kimcoleman / sample_custom_memberlite_defaults.php
Created September 1, 2021 14:59
Example of removing a class name selector from the defaults for Memberlite primary background color elements.
<?php
/**
* Example of removing a class name selector from the defaults for Memberlite primary background color elements.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
*
*/
function sample_custom_memberlite_defaults( $memberlite_defaults ) {
$memberlite_defaults['color_primary_background_elements'] = '#mobile-navigation, #mobile-navigation-height-col, .masthead, .btn_primary, .btn_primary:link, .menu-toggle, .bg_primary, .banner_primary, .has-color-primary-background-color';
@kimcoleman
kimcoleman / custom_order_manage_memberslist_columns.php
Created August 30, 2021 16:07
Reorder default columns on the Members List. In this example, we are moving Username to the first in list.
<?php
/**
* Reorder default columns on the Members List. In this example, we are moving Username to the first in list.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*
*/
@kimcoleman
kimcoleman / my_pmpro_set_application_fee_percentage.php
Created August 12, 2021 21:13 — forked from dparker1005/my_pmpro_set_application_fee_percentage.php
Modify the application fee percentage that is charged on Stripe transactions.
<?php
/**
* Modify the application fee percentage that is charged on Stripe transactions.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@kimcoleman
kimcoleman / my_pmpro_show_time_on_expiration_date.php
Last active August 6, 2021 23:26
Show the expiration time for a member's level on the Membership Account page.
<?php
/**
* Show the expiration time for a member's level on the Membership Account page.
* Useful for sites that offer hourly membership.
* Requires PMPro v2.6+
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
*
*/
@kimcoleman
kimcoleman / include_pmpro_courses_lessons_in_search.php
Created July 5, 2021 21:36
Include Lessons in search results using the default module in the Courses for Membership Add On for Paid Memberships Pro.
<?php
/**
* Include Lessons in search results using the default module in the Courses for Membership Add On for Paid Memberships Pro.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
*
*/
function include_pmpro_courses_lessons_in_search($args, $post_type) {
if ( $post_type == 'pmpro_lesson' ){
<?php
/*
* Remove tags for previously held levels after all level changes are made.
* Note that this will make a call to the ConvertKit API for each tag to remove and can be a slow process.
* Requires ConvertKit Integation for Paid Memberships Pro.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
*
*/
@kimcoleman
kimcoleman / pmpro_membership_card_shortcode.html
Created June 4, 2021 14:24
Example of the Membership Card Shortcode for Paid Memberships Pro
<!-- Example of the Membership Card Shortcode for Paid Memberships Pro -->
[pmpro_membership_card print_size="small,medium"]
@kimcoleman
kimcoleman / set_display_name_to_username_new_user_array.php
Created May 19, 2021 15:31
Set the display name as the entered username for all users created through a Paid Memberships Pro checkout.
<?php
/*
* Set the display name as the entered username for all users created through a Paid Memberships Pro checkout.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
*
*/
function set_display_name_to_username_new_user_array( $new_user_array ) {
$new_user_array['display_name'] = $new_user_array['user_login'];