Skip to content

Instantly share code, notes, and snippets.

View m1ndspark's full-sized avatar

Neil Heird m1ndspark

View GitHub Profile
@m1ndspark
m1ndspark / horizontal gravity form
Created March 31, 2017 21:00
gravity forms snippets
#gform_2 > .gform_footer {
display: inline-block;
padding: 0.85em 0 0.625em;
width: 20%;
}
#gform_2 .gform_body {
display: inline-block;
float: left;
width: 80%;
<?php
/**
* Gravity Wiz // Gravity Forms // Rename Uploaded Files
*
* Rename uploaded files for Gravity Forms. You can create a static naming template or using merge tags to base names on user input.
*
* Features:
* + supports single and multi-file upload fields
* + flexible naming template with support for static and dynamic values via GF merge tags
*
add_filter( ‘gform_tabindex’, ‘gform_tabindexer’, 10, 2 );
function gform_tabindexer( $tab_index, $form = false ) {
$starting_index = 1000; // if you need a higher tabindex, update this number
if( $form )
add_filter( ‘gform_tabindex_’ . $form[‘id’], ‘gform_tabindexer’ );
return GFCommon::$tab_index >= $starting_index ? GFCommon::$tab_index : $starting_index;
}
@m1ndspark
m1ndspark / preselected-search-example.php
Created May 30, 2017 13:04
Pre-selected faceted search using FacetWP
<script>
(function($) {
$(document).on('facetwp-refresh', function() {
if (! FWP.loaded && '' == FWP.build_query_string() && 'dev_sites/trenam/practices/cybersecurity' == FWP_HTTP.uri) {
FWP.facets['pa_hidden_facet'] = ['cybersecurity'];
}
});
})(jQuery);
</script>
@m1ndspark
m1ndspark / Center Google Re-Captcha for Gravity Forms
Last active July 23, 2018 16:53
Center Google Re-Captcha for Gravity Forms
@media only screen and (min-width: 320px) {
body .gform_wrapper div.ginput_container.ginput_recaptcha {
position: relative;
width: 100%;
padding-top: 1.5em
}
body .gform_wrapper div.ginput_container.ginput_recaptcha iframe {
position: absolute;
@m1ndspark
m1ndspark / Center Google Re-captcha Toolset Forms
Created July 23, 2018 16:53
Center Google Re-captcha Toolset Forms
@media only screen and (min-width: 320px) {
#recaptcha_cred_form_10_1_recaptcha.g-recaptcha {
position: relative;
width: 100%;
padding-top: 1.5em
}
#recaptcha_cred_form_10_1_recaptcha.g-recaptcha iframe {
position: absolute;
@m1ndspark
m1ndspark / Hide Gravity Forms Labels
Created July 23, 2018 16:55
Hide Gravity Forms Labels
add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );
@m1ndspark
m1ndspark / Responsive Gravity Forms Validation Errors
Created July 23, 2018 17:00
Gravity Forms Validation Errors Mobile-friendly(er) - by Gravity Perks
<?php
/**
* Gravity Wiz // Gravity Forms // Give First Validation Error Focus
* http://gravitywiz.com/
*/
add_filter( 'gform_pre_render', 'gw_first_error_focus' );
function gw_first_error_focus( $form ) {
add_filter( 'gform_confirmation_anchor_' . $form['id'], '__return_false' );
?>
<script type="text/javascript">
@m1ndspark
m1ndspark / Hide Gravity Forms Ajax Spinner
Created July 23, 2018 17:01
Hide Gravity Forms Ajax Spinner - by Gravity Perks
body img.gform_ajax_spinner {
display: none !important;
}
@m1ndspark
m1ndspark / Gravity Forms Live Preview
Created July 23, 2018 17:03
Gravity Forms Live Preview - by Gravity Perks
<?php
/**
* Gravity Wiz // Gravity Forms Live Preview
*
* Preview your Gravity forms on the frontend of your website. Adds a "Live Preview" link to the Gravity Forms toolbar.
*
* @version 1.0.1
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/...