Skip to content

Instantly share code, notes, and snippets.

View pbrocks's full-sized avatar

Paul Barthmaier pbrocks

View GitHub Profile
@pbrocks
pbrocks / basic_meta_box.php
Created March 23, 2018 02:26 — forked from thefuxia/basic_meta_box.php
WordPress meta box example
<?php # -*- coding: utf-8 -*-
declare( encoding = 'UTF-8' );
/**
* Plugin Name: Basic Meta Box
* Description: Create a simple meta box. Demo plugin.
* Version: 2012.02.05
* Required: 3.3
* Author: Thomas Scholz
* Author URI: http://toscho.de
* License: GPL
@pbrocks
pbrocks / pmpromyCRED.php
Created March 26, 2018 21:24 — forked from strangerstudios/pmpromyCRED.php
Award MyCRED points for members who sign up for Membership Level 1.
<?php
/*
Use this recipe in combination with MyCRED to award points to members when signing up
for Level 1 membership. This code gist could be customized to give points for another
membership level ID, award recurring points for each subscription payment, and more.
MyCRED can be downloaded/configured here: https://wordpress.org/plugins/mycred/
*/
// Register Hook for PMPro Membership Points at Signup
@pbrocks
pbrocks / acf-customizer-patch.php
Created March 31, 2018 02:36 — forked from fabrizim/acf-customizer-patch.php
Plugin to allow for Advanced Custom Fields to be used in widgets within the Customizer
<?php
/*
Plugin Name: ACF Customizer Patch
Plugin URI: https://gist.github.com/fabrizim/9c0f36365f20705f7f73
Description: A class to allow acf widget fields to be stored with normal widget settings and allow for use in customizer.
Author: Mark Fabrizio
Version: 1.0
Author URI: http://owlwatch.com/
*/
class acf_customizer_patch
@pbrocks
pbrocks / add-dashicons-to-wordpress-customizer.php
Created March 31, 2018 02:36 — forked from BoweFrankema/add-dashicons-to-wordpress-customizer.php
Add Dashicons to your Customizer Panels. You can find the dashicon CSS classes here: https://developer.wordpress.org/resource/dashicons/#id
<?php
/**
* Enqueue the stylesheet.
* http://aristeides.com/blog/modifying-wordpress-customizer/
*/
function my_enqueue_customizer_stylesheet() {
wp_register_style( 'my-customizer-css', YOUR_PLUGIN_URL. 'assets/css/customizer.css', NULL, NULL, 'all' );
wp_enqueue_style( 'my-customizer-css' );
@pbrocks
pbrocks / custom-field-register-helper.php
Last active April 9, 2018 13:17 — forked from andrewlimaza/custom-field-register-helper-checkout-email.php
Add custom field to Paid Memberships Pro Checkout Email using Register Helper
<?php
/**
* This will check for !!company_name!! in the emails body and replace it with the 'company_name' metadata (created by Register Helper).
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_email_body( $body, $email ) {
//only checkout emails + strict comparison
if ( false !== strpos( $email->template, 'checkout' ) ) {
global $current_user;
@pbrocks
pbrocks / WP_API_OAuth_Test_client.php
Created April 11, 2018 14:02 — forked from kosso/WP_API_OAuth_Test_client.php
Test PHP client for Wordpress REST API v2.0 / OAuth1.0a 0.3.0
<?php
//opcache_reset(); // Disable local dev MAMP cache
/*
WP_API_OAuth_Test_client.php
Tested with Wordpress 4.7.1
WordPress REST API - OAuth 1.0a Server v.0.3.0 - https://en-gb.wordpress.org/plugins/rest-api-oauth1/

Mike J, Gerhard P, Lauren S, Allen S chatted about a personal data exporter design that could support WooCommerce and its extensions needs (and be applicable to core itself or any plugin)

In a nutshell, we eventually thought it would be best to try having plugins (and extensions) register a callback function(s) for the export of personal data, e.g. have a plugin do something like this):

add_filter( "wp_privacy_register_export_data_callback", array( $this, 'register_export_data_callback' ) );
 
function register_export_data_callback( $export_callbacks ) {
    $export_callbacks[] = array(
        'slug' => 'stripe',
@pbrocks
pbrocks / pmpro-cancel-on-next-payments-date.php
Last active July 17, 2019 14:26 — forked from strangerstudios/pmpro_cancel_on_next_payments_date.php
Change PMPro membership cancellation to set expiration date for next payment instead of cancelling immediately.
<?php
/**
* Change cancellation to set expiration date for next payment instead of cancelling immediately.
*
* Assumes orders are generated for each payment (i.e. your webhooks/etc are setup correctly).
*
* Since 2015-09-21 and PMPro v1.8.5.6 contains code to look up next payment dates via Stripe and PayPal Express APIs.
*/
/**
@pbrocks
pbrocks / README.md
Last active May 2, 2018 17:09 — forked from ControlledChaos/README.md
Replaces "Post" in the update messages for custom post types on the "Edit" post screen.

Custom Post Type Message

WordPress Snippetthat replaces "Post" with CPT name in the update messages for custom post types on the "Edit" post screen.

@pbrocks
pbrocks / pmpro-start-of-month-payments.php
Last active May 8, 2018 13:01 — forked from eighty20results/pmpro-start-of-month-payments.php
No proration for the initial payment & set the start date for the recurring payments to the 1st of the month
<?php
/**
* Plugin Name: UNprorated initial membership payment
* Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
* Description: Will prorate the membership payment from today until the 1st of the next month.
* Version: .2.1
* Author: Thomas Sjolshagen @ Stranger Studios <thomas@eighty20results.com>
*/
/**
* Keep the membership level payment same as a full month.