Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Joshua Vandercar uamv

🏠
Working from home
Block or report user

Report or block uamv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gravity-field-template
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;
@generatepress
generatepress / gist:9fe556128433b11114b489406fc8dee4
Created Feb 14, 2019
Disable the Header Element if there isn't a featured image.
View gist:9fe556128433b11114b489406fc8dee4
add_filter( 'generate_header_element_display', function( $display ) {
if ( ! has_post_thumbnail() ) {
return false;
}
return $display;
} );
@joedooley
joedooley / gform_stripe_api_mode.php
Created Feb 5, 2018
Change Stripe API mode for targeted form.
View gform_stripe_api_mode.php
<?php
/**
* Filters the API mode for a specific form to 'test'.
*
* @param $api_mode string Either 'test' or 'live'
*
* @return string Returns 'test' for targeted form. Otherwise,
* will return the value for the $api_mode setting.
*/
@saltnpixels
saltnpixels / gform_stripe_subscriptions.php
Created Oct 10, 2017
Gravity forms stripe cancel from front end
View gform_stripe_subscriptions.php
<?php
/**
* Payment subscriptions and updating billing and cancelling subscriptions takes place with these hooks
* We need the stripe customer user id for updating billing
* we need the entry id of subscription so we can cancel it.
*/
/**
* @param $entry
@chriscoyier
chriscoyier / frontendplugins.md
Last active Sep 11, 2019
How WordPress Plugins Should Handle Front End Resources
View frontendplugins.md

How WordPress Plugins Should Handle Front End Resources

This is a WORK IN PROGRESS intended for fleshing out and feedback

It's very common for people to be unhappy with how a WordPress plugin adds front end resources to their site. If a plugin needs CSS, the plugin will add a <link> element to that CSS. If the plugin needs JavaScript, it will add a <script> to that JavaScript.

Plugins do this because it works. It's damn important for a WordPress plugin to work, even in adverse conditions. They rightfully want good ratings and little customer support.

But this comes at the cost of additional HTTP requests. In optimizing front end performance of a site, reducing the number of HTTP requests is a huge thing. Front end developers want to decide and control how front end resources are being handled, and WordPress plugins don't typically make this easy on them.

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active Nov 22, 2019
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel10k

Powerlevel10k

@jeherve
jeherve / plugin.php
Last active Mar 25, 2016
[Jetpack] Exclude certain categories from Jetpack Subscriptions
View plugin.php
<?php
/*
* Plugin Name: Exclude the asmodeus category from Jetpack Subscriptions
* Plugin URI: http://wordpress.org/plugins/jetpack/
* Description: Exclude the asmodeus category from Jetpack Subscriptions
* Author: Jeremy Herve
* Version: 1.0
* Author URI: http://jeremyherve.com
* License: GPL2+
*/
@spivurno
spivurno / gist:3710746
Created Sep 12, 2012
Gravity Wiz // Set Post Status by Field Value (Advanced)
View gist:3710746
/**
* Set Post Status by Field Value (Advanced)
* http://gravitywiz.com/2012/05/04/set-post-status-by-field-value-advanced/
*/
// update "3" to the ID of your form
add_filter('gform_post_data_3', 'gform_dynamic_post_status', 10, 3);
function gform_dynamic_post_status($post_data, $form, $entry) {
// update "5" to the ID of your custom post status field
@ScottPhillips
ScottPhillips / .htaccess
Created Feb 2, 2012
Common .htaccess Redirects
View .htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@alexkingorg
alexkingorg / hex_color_mod.php
Created Sep 3, 2011
Change the brightness of the passed in hex color in PHP
View hex_color_mod.php
<?php
/**
* Change the brightness of the passed in color
*
* $diff should be negative to go darker, positive to go lighter and
* is subtracted from the decimal (0-255) value of the color
*
* @param string $hex color to be modified
* @param string $diff amount to change the color
You can’t perform that action at this time.