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 / pmpro-add-on-learn-dash.php
Last active September 15, 2023 12:26
Paid Memberships Pro - Add On Packages Plus LearnDash
<?php
global $pmpro_addon_pages_for_courses;
// 28 is the page ID; 24 is the course ID.
// 30 is the page ID; 26 is the course ID.
$pmpro_addon_pages_for_courses = array(
28 => 24,
30 => 26,
);
function pmproap_learndash_template_redirect()
{
@ronalfy
ronalfy / pmpro-bulk-approve-members.php
Created November 12, 2020 18:06
PMPro - Bulk Approve Existing Members
<?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-add-rh-approvals.php
Created October 29, 2020 14:12
PMPro - Add RH to Approval Emails
<?php
/**
* Adds Register Helper Fields to the Approvals Email.
*
* 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-mmpu-override-checkout-page.php
Created November 6, 2020 22:49
PMPro - MMPU Override Checkout Page
<?php
/**
* The recipe checks for a /paid-memberships-pro/pages/checkout.php in the child theme
* Please keep checkout.php up to date as MMPU is updated.
*
* 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-change-level-recurring.php
Created October 13, 2020 19:39
PMPro - Change Never Label Message for Recurring Levels
<?php
/**
* Changes the output label to Recurring in member/order lists for recurring levels.
*
* 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-extra-fields.php
Created October 12, 2020 16:23
PMPro - Add Extra Fields - Sync with Add User from Admin
<?php
/**
* Modified customer gist. Adds profile fields and saves them.
* Compatible with Add User from Admin Add-On
*
* 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-bulgarian-currency.php
Created June 29, 2020 17:36
Paid Memberships Pro - Bulgarian Currency
<?php
// Adds the BGN currency to currency list.
function pmpro_currencies_bulgarian( $currencies ) {
$currencies['BGN'] = __( 'Bulgarian', 'pmpro' );
return $currencies;
}
add_filter( 'pmpro_currencies', 'pmpro_currencies_bulgarian' );
@ronalfy
ronalfy / has_post_thumbnail_fail.php
Last active July 31, 2022 10:11
Use Auto-Generate-Thumbnail plugin to generate thumbnail images when has_post_thumbnail is erroring out. This assumes you are inside of the WordPress loop.
<?php
//Assumes within the WordPress Loop
$args = array ('title' => $post->post_title);
if ( strlen( $img = get_the_post_thumbnail( get_the_ID() ) ) ) {
/* display thumbnail */
the_post_thumbnail( 'thumbnail', $args );
} else {
delete_post_meta( $post->ID, '_thumbnail_id' );
//Requires Auto Post Thumbnails plugin - http://wordpress.org/extend/plugins/auto-post-thumbnail/
if ( function_exists( 'apt_publish_post' ) ) {
@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/
*/
/**