Skip to content

Instantly share code, notes, and snippets.

@robneu
robneu / wp-config
Created February 26, 2013 20:48
Set your GF license key in wp-config
/** Define Gravity Forms License Key */
define("GF_LICENSE_KEY", "YOUR-LICENSE-KEY-HERE");
@spivurno
spivurno / gist:5065194
Last active November 7, 2022 16:31
Gravity Wiz: Use Gravity Forms Conditional Logic with Dates
<?php
/**
* Use Gravity Forms Conditional Logic with Dates
* http://gravitywiz.com/use-gravity-forms-conditional-logic-with-dates/
*/
add_filter("gform_field_value_timestamp", "gwiz_populate_timestamp");
function gwiz_populate_timestamp( $value ){
return time();
}
@spivurno
spivurno / gist:6584835
Created September 16, 2013 18:51
Gravity Forms Cookies // Saves the query string parameters from a users visit to a cookie and allows these values to be populated via Gravity Forms' Dynamic
<?php
/**
Plugin Name: Gravity Forms Cookies
Plugin URI: http://ounceoftalent.com/
Description: Saves the query string parameters from a users visit to a cookie and allows these values to be populated via Gravity Forms' Dynamic Population feature.
Version: 1.5
Author: David Smith
Author URI: http://ounceoftalent.com
License: GPL2
*/
@deltafactory
deltafactory / fix-nextgen-lightbox-path.php
Created October 2, 2013 04:57
Fix stored URLs for Lightbox assets in NextGEN Gallery 2.x. If you find that your lightbox images are missing or are pointing to the old location for the site, then this script will help.
<?php
/*
INSTRUCTIONS:
Use at your own risk. Backup your database before continuing.
1. Copy code to a file in the root of your website.
2. Change YOUR_SITE_ROOT to a value that makes sense.
3. Execute by visiting the page. Verify before/after results.
4. Change MAKE_CHANGES_TO_SITE to true and execute it again.
@jg314
jg314 / gravity_forms_ga_tracking.php
Last active November 30, 2017 20:20
Add Google Analytics Ecommerce tracking to a donation form created through Gravity Forms.
<?php
/*
* Add custom query vars to handle Google Analytics Ecommerce tracking.
* This should be placed in a plugin or in functions.php of the theme.
*
* You'll want to use the redirect method for Gravity Forms confirmations and
* turn on passing field data via a query string. An example we used was:
* donation_amount={Donation Amount:13}&donation_id={entry_id}&donation_recurring=0
*/
function sm_add_query_vars( $vars ){
@robneu
robneu / disable-jetpack-modules.php
Last active April 25, 2016 20:27
Disable unwanted Jetpack Modules. The whitelist array will allow any modules you want to remain enabled to continue to function. If you don't want the module to activate, remove it from the whitelist.
<?php
add_filter( 'jetpack_get_available_modules', 'prefix_hide_jetpack_modules' );
/**
* Disable all non-whitelisted jetpack modules.
*
* As it's written, this will allow all of the currently available Jetpack
* modules to work display and be activated normally.
*
* If there's a module you'd like to disable, simply comment it out or remove it
* from the whitelist and it will no longer be available for activation.
@robneu
robneu / gform-split-test.php
Last active January 2, 2016 10:19
Create an A/B Split test using GravityForms
<?php
/**
* Create a split test using two different GravityForms
*
* Allows you to test the effectiveness of two different forms by displaying each
* one 50% of the time. Tracking CTR using the built-in GravityForms functionality
* should give you an idea of which form is most effective.
*
* @uses GravityForms
* @author FAT Media, LLC
@GaryJones
GaryJones / functions.php
Last active January 11, 2016 05:19
Default styles for HTML5 galleries and captions.
<?php
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
For CSS
.attachment-thumbnail {
float: left;
padding: 10px;
}
For functions.php
<?
//=========================================================== SUBSCRIBER SHORTCODE
function subscriber_shortcode($atts, $content = null ) {
extract(shortcode_atts(array(
'page' => '',
'headline' => 'Subscribe for free updates',
'button' => 'Subscribe',
'quote' => '',
'class' => 'box_main',
'form_class' => 'centered_form',