Skip to content

Instantly share code, notes, and snippets.

View mattpramschufer's full-sized avatar

Matt Pramschufer mattpramschufer

View GitHub Profile
@mattpramschufer
mattpramschufer / restricted.html
Last active January 9, 2020 13:05
Center Restricted Content Message
<div style="text-align:center; max-width:400px; margin:30px auto;">
<h1>Ooop, contenido restringido</h1>
Entrá a la tienda y adquirí este curso!
&nbsp;
[products ids='{{product_id}}']
</div>
@mattpramschufer
mattpramschufer / gist:deda3eca703142bb3467190d883326bd
Created December 4, 2019 17:34
Simple shortcode to display featured listings on GD Directory Archive Pages
<?php
/**
*
* @wordpress-plugin
* Plugin Name: GeoDirectory Extras
* Plugin URI: http://emoxie.com
* Description: Various extra functions for GeoDirectory
* Version: 1.1
* Author: Matt Pramschufer
* Author URI: http://emoxie.com
@mattpramschufer
mattpramschufer / populate_gravity_forms_pre_submission.php
Created June 5, 2019 18:31 — forked from BronsonQuick/populate_gravity_forms_pre_submission.php
Populate a hidden field in Gravity Forms before submission
<?php
/* gform_pre_submission will do all forms. gform_pre_submission_1 will do a form with an ID of 1
* Keep an eye on the priority of the filter. In this case I used 9 because the Salesforce plugin we used ran a presubmission filter at 10 so we needed this to happen before it
*/
add_filter( "gform_pre_submission_1", "add_salesforce_campaign_id_footer", 9 );
function add_salesforce_campaign_id_footer( $form ){
foreach($form["fields"] as &$field)
if($field["id"] == 2){
/* Set the variable you want here - in some cases you might need a switch based on the page ID.
* $page_id = get_the_ID();
@mattpramschufer
mattpramschufer / class-wcs-importer.php
Last active February 13, 2019 21:24
Includes creating orders associated with imported subscriptions
<?php
/**
* The main importer class.
*
* This class reads a number of lines from the CSV file and imports the subscriptions based on the data
* in those rows. All errors and unexpected PHP shutdowns will be logged to assist in debugging.
*
* @since 1.0
*/
@mattpramschufer
mattpramschufer / my-downloads.php
Created January 31, 2019 17:11
Test patch for removing PHP warning Warning: A non-numeric value encountered in
<div id='downloads-wrapper'>
<?php if ( count( $downloads ) > 0 ) : ?>
<h2><?php echo apply_filters( 'woocommerce_my_account_my_downloads_title', __( $heading, 'woocommerce' ) ); ?></h2>
<ul class="wc-my-downloads-digital-downloads">
<?php foreach ( $downloads as $download ) : ?>
<?php
// Get order date
$order = new WC_Order( $download['order_id'] );
@mattpramschufer
mattpramschufer / shortcode-purchased.php
Created June 28, 2018 14:37
DataTables Integration for WooCommerce Pay Per Post Plugin
<?php
/**
* Do not edit this file directly. You can copy this file to your theme directory
* in /your-theme/woocommerce-pay-per-post/shortcode-purchased.php
* The $purchased variable is a WP Posts Object of purchased posts.
*/
?>
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<div class="wc-ppp-purchased-container">
@mattpramschufer
mattpramschufer / woocommerce-email-admin-on-address-change.php
Created February 14, 2018 15:27
Email Admin when WooCommerce Customer Changes Address
<?php
/**
* Plugin Name: WooCommerce Email Customer Address
* Description: Email the site admin when a customer changes their address
* Author: Matt Pramschufer
* Version: 1.0.0
*
*/
function greenmagazine_email_customer_address( $user_id ) {
@mattpramschufer
mattpramschufer / functions.php
Created February 14, 2018 14:51
Modify WooCommerce Subscriptions Subscription Strings
<?php
add_filter('woocommerce_subscriptions_product_price_string', 'modified_subscription_strings', 10, 3);
function modified_subscription_strings($subscription_string, $product, $include){
switch($product->get_slug()){
case 'green-magazine-subscription':
case 'classic-farm-tractor-subscription':
case 'little-green-magazine-subscription':
return '$' . number_format($product->get_price(), 2, '.', '') . ' / year';
break;
@mattpramschufer
mattpramschufer / functions.php
Created February 14, 2018 14:50
Adding custom fields to Wordpress User Profile
<?php
add_action( 'show_user_profile', 'extra_user_profile_fields' );
add_action( 'edit_user_profile', 'extra_user_profile_fields' );
function extra_user_profile_fields( $user ) { ?>
<h3><?php _e("LEGACY IMPORTED USER DATA", "blank"); ?></h3>
<table class="form-table">
<tr>