Skip to content

Instantly share code, notes, and snippets.

View cliffordp's full-sized avatar

Clifford cliffordp

View GitHub Profile
@cliffordp
cliffordp / force-ssl-url-scheme.php
Last active March 27, 2017 16:32 — forked from webaware/force-ssl-url-scheme.php
Get SSL / HTTPS to work properly on WP Engine type hosts. Jason Cohen, Aug 28 05:29 pm (CDT): This is because the SSL processing is done at the front-end caching layer and not at the back-end PHP layer. By the time the request gets back there, the protocol is HTTP again rather than HTTPS. However, WordPress also defines a PHP variable saying whe…
<?php
/*
Plugin Name: Force SSL URL Scheme
Plugin URI: https://gist.github.com/cliffordp/6378826
Description: Force the protocol scheme to be HTTPS when is_ssl() doesn't work. Recommended to me by Jason Cohen of WP Engine on 2013-08-28.
Version: 1.0.0
Author: WebAware
Author URI: http://www.webaware.com.au/
*/
@cliffordp
cliffordp / class-pt-customize-control-range.php
Last active August 29, 2015 14:27 — forked from primozcigler/class-pt-customize-control-range.php
Footer widgets layout customizer control.
<?php
/**
* Range Control Class
*/
class WP_Customize_Range_Control extends WP_Customize_Control {
/**
* @access public
* @var string
@cliffordp
cliffordp / gist:791b32f0d400a89436c9
Last active January 8, 2016 21:07 — forked from Pross/gist:a28df9847ff60896017b
Export woocommerce order emails for products by specific author -- with showing Order Completed date and Variation key and value if applicable
SELECT DATE_FORMAT( a.meta_value, '%Y-%m-%d' ) as Completed_Date, /* 2015-01-01 date format */
b.meta_value as Email,
wp_woocommerce_order_items.order_item_name as Product,
c.meta_key as Variation_Type,
c.meta_value as Variation_Name
FROM wp_woocommerce_order_items
left join wp_postmeta a ON wp_woocommerce_order_items.order_id = a.post_id AND a.meta_key = '_completed_date'
left join wp_postmeta b ON wp_woocommerce_order_items.order_id = b.post_id AND b.meta_key = '_billing_email'
left join wp_woocommerce_order_itemmeta c ON wp_woocommerce_order_items.order_item_id = c.order_item_id AND c.meta_key NOT LIKE '\_%' /* escape the underscore wildcard character -- get keys not starting with underscore */
WHERE wp_woocommerce_order_items.order_item_id IN (
@cliffordp
cliffordp / functions.php
Last active September 26, 2021 18:10 — forked from jesseeproductions/tribe-ical-one-year.php
The Events Calendar Get Events for 1 Year from Today in iCal Export File -- http://example.com/events/?ical=1&year-feed
<?php
// From https://gist.github.com/cliffordp/ab1f7c4d95723ee6f892/, a fork of https://gist.github.com/jesseeproductions/2b1af6527b7029eaea6e
// References:
// https://theeventscalendar.com/support/forums/topic/ical-only-pushing-1-month-at-a-time/
// https://theeventscalendar.com/support/forums/topic/how-users-can-subscribe-to-my-events-calendar-in-their-personal-calendars/#post-1022932
// https://tribe.uservoice.com/forums/195723-feature-ideas/suggestions/3777092-subscribe-to-calendar-via-ical
/*
* The Events Calendar Get Events for 1 Year from Today in iCal Export File
* add coding to child theme's functions.php
* Tested works with The Events Calendar v3.12 and v4.0
@cliffordp
cliffordp / tribe_modify_list_widget_args.php
Created January 23, 2016 03:55 — forked from niconerd-zz/tribe_modify_list_widget_args.php
The Events Calendar - Limit the upcoming widget to just event running today
<?php
/*
* The Events Calendar - Limit the upcoming widget to just event running today
*/
add_filter( 'tribe_events_list_widget_query_args', 'tribe_modify_list_widget_args', 10, 1 );
function tribe_modify_list_widget_args ( $args ) {
$start_date_init = date ( 'Y-m-d' );
$start_date_end = $start_date_init . ' 23:59:59';
@cliffordp
cliffordp / tribe-event-list-target-today.php
Last active April 23, 2016 03:38 — forked from jesseeproductions/tribe-event-list-target-today.php
The Events Calendar - Target a Specific Event List Widget to Only Show Todays Events
<?php
/**
* The Events Calendar - Target a Specific Event List Widget to Only Show Today's Events
*
* modify tribe-events-adv-list-widget-2 to id of widget
*/
function tribe_modify_list_widget_args_for_today( $args ) {
$start_date_init = date ( 'Y-m-d' );
@cliffordp
cliffordp / tribe-tickets-plus-prevent-emails.php
Created January 27, 2016 16:14 — forked from jesseeproductions/tribe-tickets-plus-prevent-emails.php
Events Tickets Plus - WooCommerce Tickets - Prevent Ticket Email from being sent.
/*
* Events Tickets Plus - WooCommerce Tickets - Prevent Ticket Email from being sent.
* @ Version 4.0
*/
add_action( 'init', 'wootickets_stop_sending_email' );
function wootickets_stop_sending_email() {
if ( class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) ) {
$woo = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();
remove_filter( 'woocommerce_email_classes', array( $woo, 'add_email_class_to_woocommerce' ) );
add_action( 'woocommerce_email_after_order_table', array( $woo, 'add_tickets_msg_to_email' ) );
@cliffordp
cliffordp / tribe_set_default_date.php
Last active January 27, 2016 17:52 — forked from elimn/tribe_set_default_date.php
MT | TEC | Set the default date for views like List and Month (e.g. set date to prior to any events to display all prior/past events). If you only want it to apply to List view, check that it's List view.
<?php
/*
* Set the default date for views like List and Month
*/
function tribe_set_default_date () {
if ( !is_single() && empty( $_REQUEST['tribe-bar-date'] ) ) {
$_REQUEST['tribe-bar-date'] = '2000-01-01';
}
}
@cliffordp
cliffordp / functions.php
Created May 17, 2016 03:18 — forked from theeventscalendar/functions.php
Change the word Event/Events globally on your calendar. This example uses Meeting/Meetings instead. Change the single and plural options below to whatever word you'd like to use.
<?php
// Singular
add_filter( 'tribe_event_label_singular', 'event_display_name' );
function event_display_name() {
return 'Meeting';
}
add_filter( 'tribe_event_label_singular_lowercase', 'event_display_name_lowercase' );
function event_display_name_lowercase() {
return 'meeting';
@cliffordp
cliffordp / exclude events category.php
Created June 16, 2016 03:10 — forked from theeventscalendar/exclude events category.php
Excludes specified categories from List and Month views. Add you own categories in line 9.
<?php
/*
* Removes categories "meetup" and "shindig" from list and month views
*/
function tribe_exclude_events_category( $wp_query ) {
// Slugs for the categories you wish to hide
$exclude_cats = array('meetup', 'shindig');