Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Ronald Huereca ronalfy

🏠
Working from home
View GitHub Profile
@ronalfy
ronalfy / pmpro-uk-taxes.php
Created Nov 23, 2020
Gist UK Taxes on Checkout / Invoice / Etc.
View pmpro-uk-taxes.php
<?php
/**
* 1. Adds 20% tax text to the level cost text.
* 2. Adds 20% tax to invoice if checking out as UK customer.
* 3. Adds 20% tax if UK to checkout and invoice.
*
* 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/
@ronalfy
ronalfy / pmpro-deregister-jquery.php
Created Nov 20, 2020
PMPro - De-register jQuery and Assign it new value
View pmpro-deregister-jquery.php
<?php
/**
* Deregister core WordPress scripts and use CDN jQuery instead.
*
* Not recommended for wide-use. May neeed to update this when WordPress 5.6 is released.
*
* 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/
@ronalfy
ronalfy / pmpro-jquery-dequeue.php
Created Nov 20, 2020
PMPro - Prevent Multiple jQuery Scripts From Running
View pmpro-jquery-dequeue.php
<?php
/**
* Dequeue's theme's custom JS handler, forces jQuery as a dependency. Testing code is commented out below.
*
* 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/
*/
function my_pmpro_dequeue_script_in_theme() {
@ronalfy
ronalfy / pmpro-restrict-categories-sub-site.php
Created Nov 20, 2020
PMPro - Restrict Categories on Sub-site in a Multisite Network
View pmpro-restrict-categories-sub-site.php
<?php
/**
* Restrict categories on the sub-site of a MS network.
* Install as an mu-plugin (advanced users only)
*/
function my_pmpro_member_pmpro_has_membership_access_filter( $access, $post, $user, $levels ) {
// If main site, leave alone.
if ( is_main_site() || is_admin() ) {
return $access;
@ronalfy
ronalfy / pmpro-acf-restrict-domains-rh.php
Created Nov 19, 2020
PMPro - ACF Pro - Restrict Domains Level with Register Helper
View pmpro-acf-restrict-domains-rh.php
<?php
/**
* Requires ACF Pro. Registers an options page and restricts by level and domain. Add approved domains via Register helper (can be optional)
*
* !important
* Change 12 to level you'd like to have the domain field on.
* Change 13 to level ID you'd like to restrict.
*
* 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.
@ronalfy
ronalfy / pmpro-rh-restrict-level.php
Created Nov 13, 2020
PMPRo - Register Helper Restrict by Level
View pmpro-rh-restrict-level.php
<?php
function my_pmprorh_init() {
// don't break if Register Helper is not loaded
if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
return false;
}
$fields = array();
$fields[] = new PMProRH_Field(
'besuchen_webinar',
View pmpro-display-membership-levels-for-posts.php
<?php
/**
* Show levels for a post/page in the admin.
*
* 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/
*/
function pmprobe_manage_posts_columns( $columns, $post_type)
@ronalfy
ronalfy / pmpro-bulk-approve-members.php
Created Nov 12, 2020
PMPro - Bulk Approve Existing Members
View pmpro-bulk-approve-members.php
<?php
/**
* Bulk approve existing members.
*
* 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/
*/
/**
@ronalfy
ronalfy / pmpro-acf-add-options-page.restrict-levels-domains.php
Created Nov 12, 2020
PMPro + ACF - Add Options Page and Restrict Levels by Domains
View pmpro-acf-add-options-page.restrict-levels-domains.php
<?php
/**
* Requires ACF Pro. Registers an options page and restricts by level and domain.
*
* 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/
*/
@ronalfy
ronalfy / pmpro-email-confirmation-add-body-classes.php
Created Nov 11, 2020
PMPro - Email Confirmation Add Body Classes
View pmpro-email-confirmation-add-body-classes.php
<?php
/**
* Set up classes for email confirmation.
*
* Available classes:
*
* 1. Logged in: pmpro-body-is-logged-in
* 2. Logged out: pmpro-body-is-logged-out
* 3. Logged in and and active member: pmpro-body-has-membership-level, pmpro-body-has-membership-level-n
* 4. Logged in and awaiting confirmation: pmpro-body-pending-confirmation