Skip to content

Instantly share code, notes, and snippets.

View mattpramschufer's full-sized avatar

Matt Pramschufer mattpramschufer

View GitHub Profile
@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 / 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 / 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 / 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 / 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>