Skip to content

Instantly share code, notes, and snippets.

View cliffordp's full-sized avatar

Clifford cliffordp

View GitHub Profile
// put uploaded files into filetype based directories
add_filter('wp_handle_upload_prefilter', 'wpse_25894_handle_upload_prefilter');
add_filter('wp_handle_upload', 'wpse_25894_handle_upload');
function wpse_25894_handle_upload_prefilter( $file )
{
add_filter('upload_dir', 'wpse_25894_custom_upload_dir');
return $file;
}
@cliffordp
cliffordp / tribe_neuter_qr.php
Last active April 2, 2021 19:29 — forked from elimn/tribe_neuter_qr.php
MT | TEC | Hide QR codes from the Email/Tickets sent to purchasers
<?php
/*
* Hides QR codes from the Email/Tickets sent to purchasers
* No longer needed as of https://theeventscalendar.com/maintenance-release-for-the-week-of-27-may-2018/
*/
function tribe_neuter_qr () {
if ( class_exists( 'Tribe__Tickets_Plus__Main' ) ) {
$qr_class = Tribe__Tickets_Plus__Main::instance()->qr();
remove_action( 'tribe_tickets_ticket_email_ticket_bottom', array( $qr_class, 'inject_qr' ) );
<?php
/*
Plugin Name: Programmatically add Gravity Forms
Plugin URI: https://daan.kortenba.ch/programmatically-add-gravity-forms/
Description: Programmatically add persistent Gravity Forms forms.
Author: Daan Kortenbach
Version: 0.1
Author URI: https://daan.kortenba.ch/
License: GPLv2 or later
*/
@cliffordp
cliffordp / tribe_remove_venue_org_links.php
Last active March 3, 2020 17:53 — forked from elimn/tribe_remove_venue_org_links.php
MT | ECP | Remove the frontend links to the venue and organizer pages when Pro is active.
@cliffordp
cliffordp / sync-files-chart.html
Last active February 2, 2020 15:05 — forked from steveandroulakis/sync-files-chart
google charts sync data
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://vera183.its.monash.edu.au/static/js/lib/jquery-1.7.1.min.ddb84c158728.js"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var jsonData = $.ajax({
@cliffordp
cliffordp / a_faster_load_textdomain.php
Created January 28, 2020 18:45 — forked from soderlind/a_faster_load_textdomain.php
A faster load_textdomain for WordPress
<?php
/*
Plugin Name: A faster load_textdomain
Version: 0.0.1
Description: While we're wating for https://core.trac.wordpress.org/ticket/32052.
Author: Per Soderlind
Author URI: https://soderlind.no
Plugin URI: https://gist.github.com/soderlind/610a9b24dbf95a678c3e
@link https://bjornjohansen.no/wordpress-translations-loading-time
License: GPL
@cliffordp
cliffordp / private-debug-log.php
Created October 8, 2018 04:07 — forked from webaware/private-debug-log.php
Enable WordPress debug log to a private folder not accessible from the web. See http://wordpress.stackexchange.com/q/84132/24260 for details and motivations. NB: currently needs to be manually edited to specify the private folder path;
<?php
/*
Plugin Name: Private Debug Log
Description: Enable debug log to a private folder not accessible from the web
Version: 0.0.1
Author: WebAware
Author URI: http://www.webaware.com.au/
*/
/*
@cliffordp
cliffordp / gravityview-modify-caps-by-id.php
Last active September 25, 2018 20:13 — forked from zackkatz/gravityview-modify-caps-by-id.php
GravityView - Examples for modifying editing capabilities by View ID and Entry ID
<?php
// Forked from gist linked at https://docs.gravityview.co/article/311-gravityview-capabilities
/**
* Modify whether an user has access to edit a specific View.
*
* @see https://codex.wordpress.org/Plugin_API/Filter_Reference/user_has_cap
*
* @param array $allcaps All the capabilities of the user
// Gravity Forms Dynamic Redirect
add_filter( 'gform_confirmation', 'dlm_gf_dynamic_redirect', 10, 4 );
function dlm_gf_dynamic_redirect( $confirmation, $form, $entry, $ajax ) {
// DLM GF Handler
$dlm_gf_handler = new DLM_GF_Gravity_Forms_Handler();
// fetch download ID dynamically from form
$lead_id = $dlm_gf_handler->get_lead_index_of_dlm_field( $form );
@cliffordp
cliffordp / AdminPage.php
Last active September 5, 2018 03:59 — forked from carlalexander/AdminPage.php
WordPress and the single responsibility principle - from https://carlalexander.ca/single-responsibility-principle-wordpress/
<?php
/**
* The WordPress Meme Shortcode admin page.
*
* @author Carl Alexander
*/
class WPMemeShortcode_AdminPage
{
/**