Skip to content

Instantly share code, notes, and snippets.

@cfxd
cfxd / full-width-inline-form.less
Created October 4, 2014 21:41
Bootstrap 3 full width inline form LESS mixin (hack using input group)
.full-width {
& .input-group-btn:last-child > .btn {
margin-left: 5px;
.border-left-radius(@border-radius-base);
}
& .form-control:first-child {
.border-right-radius(@border-radius-base);
}
}
@cfxd
cfxd / gf-inline-form.less
Last active August 29, 2015 14:07
Bootstrap 3 inline form for Gravity Forms (only tested with 1 input field and 1 submit button)
/*
*
* Bootstrap 3 inline form for Gravity Forms
*
* Use with a class assigned to the form
* or on .gform to affect all Gravity forms
*
* Example 1 (affects targeted form class only): .my-form-class { &:extend(.gravity_form_inline all); }
*
* Example 2 (affects all Gravity Forms): .gform { &:extend(.gravity_form_inline all); }
@cfxd
cfxd / gf-input-group.less
Created October 6, 2014 05:29
Bootstrap 3 input group for Gravity Forms (only tested with 1 input field and 1 submit button)
/*
*
* Bootstrap 3 input group form for Gravity Forms
*
* Use with a class assigned to the form
* or on .gform to affect all Gravity forms
*
* Example 1 (affects targeted form class only): .my-form-class { &:extend(.gravity_form_input_group all); }
*
* Example 2 (affects all Gravity Forms): .gform { &:extend(.gravity_form_input_group all); }
@cfxd
cfxd / bs3-gravity-forms.less
Created October 6, 2014 05:31
Bootstrap 3 default styles for Gravity Forms (based on http://roots.io/style-gravity-forms-with-bootstrap/ and improved slightly)
/*
*
* Bootstrap 3 reset for Gravity Forms
*
*/
.gform_wrapper {
ul {
&:extend(.list-unstyled all);
margin: 0;
@cfxd
cfxd / cf7-inline-form.less
Created October 6, 2014 06:42
Bootstrap 3 inline form for Contact Form 7 (only tested with 1 input field and 1 submit button)
/*
*
* Bootstrap 3 inline form for Contact Form 7
*
* In the shortcode, you must use html_id="my-id"
* or html_class="my-class" to target a specific form
*
* Actual form sample:
* <label for="your-email">Email:</label>
* [email* your-email 0/ placeholder "enter your email"]
@cfxd
cfxd / cf7-inline-form-full-width.less
Created October 6, 2014 06:47
Bootstrap 3 full width inline form for Contact Form 7 (only tested with 1 input field and 1 submit button)
/*
*
* Bootstrap 3 inline form *full width* for CF7
*
* In the shortcode, you must use html_id="my-id"
* or html_class="my-class" to target a specific form
*
* Actual form sample:
* <label for="your-email">Email:</label>
* [email* your-email 0/ placeholder "enter your email"]
@cfxd
cfxd / disable_gforms_auto_scroll.php
Last active August 29, 2015 14:07 — forked from rutger1140/gist:4994751
Disable auto scrolling of Gravity Forms
<?php
add_filter('gform_confirmation_anchor', '__return_false');
?>
<?php
function localize_ajax_variables() {
wp_localize_script('your_js', 'wp_ajax_vars', array(
'admin_url' => admin_url('admin-ajax.php')
));
}
add_action('wp_enqueue_scripts', 'localize_ajax_variables', 999);
@cfxd
cfxd / Gruntfile.js
Created November 10, 2014 03:40
WordPress Database Sync (both ways) with Grunt. See http://cfxdesign.com/wordpress-database-sync-with-grunt#update
grunt.initConfig({
mysql: grunt.file.readJSON('mysql.json'),
timestamp: grunt.template.today('mm-dd-yyyy_HH-MM-ss'),
sshexec: {
dump_remote_db: {
options: {
host: '<%= mysql.remote.host %>',
username: '<%= mysql.remote.username %>',
agent: process.env.SSH_AUTH_SOCK
},
@cfxd
cfxd / gf.php
Created November 13, 2014 17:49
Populate Gravity Forms in an ACF select field named "subscribe_form_header"
<?php
function populate_gravity_forms($field) {
if(class_exists('RGFormsModel')) {
$forms_array = array();
$forms = RGFormsModel::get_forms(null, 'title');
foreach($forms as $form) {
$forms_array[$form->id] = $form->title;