Skip to content

Instantly share code, notes, and snippets.

View uamv's full-sized avatar
🏠
Working from home

Joshua Vandercar uamv

🏠
Working from home
View GitHub Profile
@generatepress
generatepress / gist:9fe556128433b11114b489406fc8dee4
Created February 14, 2019 22:36
Disable the Header Element if there isn't a featured image.
add_filter( 'generate_header_element_display', function( $display ) {
if ( ! has_post_thumbnail() ) {
return false;
}
return $display;
} );
add_filter( 'gform_form_post_get_meta_7', 'add_form_fields' );
function add_form_fields( $form ) {
// Don't make the parent form messy
if ( ! GFCommon::is_form_editor() ) {
// form we are adding fields to
$parent_id = $form['id'];
// template form ID
$childId = 5;
@carlalexander
carlalexander / expect-header-fix.php
Last active August 13, 2021 00:40
WordPress "Expect" header fix
<?php
/**
* By default, cURL sends the "Expect" header all the time which severely impacts
* performance. Instead, we'll send it if the body is larger than 1 mb like
* Guzzle does.
*/
function add_expect_header(array $arguments)
{
$arguments['headers']['expect'] = '';
@webzunft
webzunft / canceled-subscriptions.sql
Last active October 4, 2022 13:15
SQL queries to analyse canceled subscriptions managed with EDD Recurring Payments
# Basic queries to analyse canceled subscriptions using EDD Recurring Payments pre EDD 3.0
# Use EXPLAIN if you have large stores since the "notes" column is not indexed and queries can take some time
# Some of these reports might be worth storing as Views and look at the graphs PHPMyAdmin can also create from them
# List subscription cancelation with creation and cancelation date, as well as the user who canceled
# good as a basis for further queries
SELECT ID,
created,
REGEXP_SUBSTR( REGEXP_SUBSTR( notes, '.* Status changed from active to cancelled .*' ), '^[a-z]+ [0-9]+, [0-9]+' ) AS 'date',
/**
* This snippet will add a datepicker to the list field of Gravity Forms.
* Just copy paste this snippet and complete the configuration at the bottom
* Also make sure that Jquery UI is loaded otherwise this won't work (<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>)
*
* @author Johan d'Hollander
* @link <https://geekontheroad.com>
**/
jQuery(document).ready(function() {