Skip to content

Instantly share code, notes, and snippets.

View ronalfy's full-sized avatar
🏠
Working from home

Ronald Huereca ronalfy

🏠
Working from home
View GitHub Profile
@ronalfy
ronalfy / highlight-share-posts-only.php
Last active December 4, 2023 06:48
Highlight and Share - Enable Posts Only
<?php
// Can use Code Snippets to insert: https://wordpress.org/plugins/code-snippets/
// Only enable on single posts (blog posts).
add_filter(
'has_enable_content',
function( $load_content ) {
if ( is_single() ) {
return true;
}
return false;
@ronalfy
ronalfy / appsero-init-class.php
Created May 30, 2022 15:32
Appsero Initialization Class
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Installation instructions: https://appsero.com/docs/appsero-developers-guide/appsero-client/
*/
/**
@ronalfy
ronalfy / conditional-theme-json.php
Last active March 30, 2022 13:43
Conditionally Load theme.json
<?php
/**
* Conditionally load the default theme.json file.
*
* Assumes directory structure of /theme-name/skins/skin-name/theme.json (see switch statement below).
*
* @package coaching-pro
*/
/**
### Keybase proof
I hereby claim:
* I am ronalfy on github.
* I am ronaldhuereca (https://keybase.io/ronaldhuereca) on keybase.
* I have a public key ASBKxn9O1p_ffHRRGdcYVEjImU2uPutZWFD9l-lSz70HHAo
To claim this, I am signing this object:
@ronalfy
ronalfy / pmpro-uk-taxes.php
Created November 23, 2020 21:48
Gist UK Taxes on Checkout / Invoice / Etc.
<?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 November 20, 2020 20:50
PMPro - De-register jQuery and Assign it new value
<?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 November 20, 2020 19:57
PMPro - Prevent Multiple jQuery Scripts From Running
<?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 November 20, 2020 14:49
PMPro - Restrict Categories on Sub-site in a Multisite Network
<?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 November 19, 2020 14:13
PMPro - ACF Pro - Restrict Domains Level with Register Helper
<?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 November 13, 2020 15:30
PMPRo - Register Helper Restrict by Level
<?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',