Skip to content

Instantly share code, notes, and snippets.

View mattpramschufer's full-sized avatar

Matt Pramschufer mattpramschufer

View GitHub Profile
@mattpramschufer
mattpramschufer / woocommerce-subscription-export.php
Created February 14, 2018 14:35
Export WooCommerce Subscriptions Shipping Information
<?php
/*
Plugin Name: WooCommerce Subscription Export
Plugin URI: https://emoxie.com
Description: Custom plugin to export shipping data for Magazine Subscribers
Version: 1.0.0
Author: Matt Pramschufer
Author URI:
*/
defined( 'ABSPATH' ) or exit;
@mattpramschufer
mattpramschufer / gist:7645f0b61c8f4e2fe8921bedac259d0f
Created February 14, 2018 14:22
Extend WooCommerce Subscriptions Timeframes
<?php
/**
* Plugin Name: Extend WooCommerce Subscription Intervals
* Description: Add custom billing & subscription intervals to WooCommerce Subscriptions
* Author: Matt Pramschufer
* Author URI: https://emoxie.com
* Version: 1.0
* License: GPL v2
*/
@mattpramschufer
mattpramschufer / gist:957039753ea7a0bc3344e2f817304156
Created December 11, 2017 18:21 — forked from corsonr/gist:7215762
WooCommerce: Hide Checkout Fields For Virtual Products
<?php
add_filter( 'woocommerce_checkout_fields' , 'woo_remove_billing_checkout_fields' );
/**
* Remove unwanted checkout fields
*
* @return $fields array
*/
function woo_remove_billing_checkout_fields( $fields ) {
@mattpramschufer
mattpramschufer / functions.php
Created January 11, 2017 14:04
Add Featured Image to RSS Feed Description and Create separate image Node in Wordpress,
<?php
// Add the image and thumbnail node to RSS feed
function add_rss_node_image_thumbnail() {
global $post;
if (has_post_thumbnail($post->ID)):
echo "<image>" . get_the_post_thumbnail_url($post->ID, 'medium') . "</image>\n";
endif;
}
add_action('rss2_item', 'add_rss_node_image_thumbnail');
@mattpramschufer
mattpramschufer / functions.php
Last active January 11, 2017 14:04
Add Offset to Wordpress RSS Feed
<?php
function rss_pre_get_posts($query) {
if (isset($_GET['days_past']) && is_feed()) {
$query->set('date_query', array(array('after' => $_GET['days_past'] . ' days ago',)));
}
if (isset($_GET['offset']) && is_feed()) {
$query->set('offset', $_GET['offset']);
}
if (isset($_GET['cat']) && is_feed()) {
$query->set('cat', $_GET['cat']);
@mattpramschufer
mattpramschufer / isDuringBlackOutTime.php
Last active January 11, 2017 14:04
Figures out if the current time is during our black out period which we do not want to text users
<?php
/**
* Figures out if the current time is during our black out period which we do not want to text users
*
* @return bool
*/
static public function isDuringBlackOutTime() {
$currentTime = Carbon::now();
if($currentTime->format('A') == 'AM'){