Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@esedic
esedic / gist:8f50ddfb2497961434bf891ac2c6395d
Created April 17, 2024 12:29 — forked from vdrover/gist:ebdbf65f5f4e9ee5545255e9c36bd422
Wordpress - Backdate scheduled posts
// Adds a meta box to the post editing screen for changing the post's publication
// date and time after it has initially been published.
// Only visible to administrators.
// Place in functions.php file.
function cdap_add_meta_box() {
// Check if the current user is an administrator
if (current_user_can('administrator')) {
add_meta_box(
'cdap_meta_box', // ID of the meta box
// VALUE UNIT STRIPPING AND CONVERSION FUNCTION TOOLS
// By Nicolas Giethlen (aka Chmood)
// VARIABLES
$browser-fontsize-base: 16 !default; // Default browser font-size in px (unitless)
$pixels-per-rem: 10 !default; // Root font-size in px (unitless)
// FUNCTIONS
@esedic
esedic / gist:ca79b1338908261bdcb085eb240a8069
Created October 23, 2023 15:33 — forked from spivurno/gist:3708752
Gravity Wiz // Limit How Many Checkboxes Can Be Checked
<?php
/**
* Limit How Many Checkboxes Can Be Checked
* http://gravitywiz.com/2012/06/11/limiting-how-many-checkboxes-can-be-checked/
*/
class GFLimitCheckboxes {
public static $field_limits;
@esedic
esedic / gw-limit-checkboxes-usage.php
Created October 23, 2023 15:33 — forked from spivurno/gw-limit-checkboxes-usage.php
Gravity Wiz // Limit Checkboxes Usage
<?php
// standard usage
new GFLimitCheckboxes(115, array(
5 => array(
'min' => 2,
'max' => 3
)
));
@esedic
esedic / gw-gravity-forms-submission-limit.php
Created October 23, 2023 15:33 — forked from spivurno/gw-gravity-forms-submission-limit.php
Gravity Wiz // Gravity Forms // Limit Submissions Per Time Period (by IP, User, Role, Form URL, or Field Value)
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-submission-limit.php
*/
/**
* Gravity Wiz // Gravity Forms // Limit Submissions Per Time Period (by IP, User, Role, Form URL, or Field Value)
*
* Limit the number of times a form can be submitted per a specific time period. You modify this limit to apply to
@esedic
esedic / gw-gravity-forms-disable-autocomplete.php
Created October 23, 2023 15:33 — forked from spivurno/gw-gravity-forms-disable-autocomplete.php
Gravity Wiz // Gravity Forms // Disable Auto-complete
<?php
// Disable auto-complete on form.
add_filter( 'gform_form_tag', function( $form_tag ) {
return str_replace( '>', ' autocomplete="off">', $form_tag );
}, 11 );
// Diable auto-complete on each field.
add_filter( 'gform_field_content', function( $input ) {
return preg_replace( '/<(input|textarea)/', '<${1} autocomplete="off" ', $input );
@esedic
esedic / gw-gravity-forms-set-input-as-tel.php
Created October 23, 2023 15:33 — forked from spivurno/gw-gravity-forms-set-input-as-tel.php
Gravity Wiz // Gravity Forms // Set Input Type as Tel
<?php
/**
* Gravity Wiz // Gravity Forms // Set Input Type as Tel
* http://gravitywiz.com/
*/
add_filter( 'gform_field_content_723_10', 'gw_set_tel_input_type' );
function gw_set_tel_input_type( $input ) {
$input = preg_replace( "/type='[\\w]+'/", "type='tel'", $input );
return $input;
}
@esedic
esedic / gw-gravity-forms-first-error-focus.php
Created October 23, 2023 15:32 — forked from spivurno/gw-gravity-forms-first-error-focus.php
Gravity Wiz // Gravity Forms // Give First Validation Error Focus
<?php
/**
* Gravity Wiz // Gravity Forms // Give First Validation Error Focus
* http://gravitywiz.com/
*
* Plugin Name: Gravity Forms First Error Focus
* Plugin URI: https://gravitywiz.com/make-gravity-forms-validation-errors-mobile-friendlyer/
* Description: Automatically focus (and scroll) to the first field with a validation error.
* Author: Gravity Wiz
* Version: 1.1
@esedic
esedic / gravity-forms-move-progress-bar-bottom.php
Created October 23, 2023 15:32 — forked from spivurno/gravity-forms-move-progress-bar-bottom.php
Gravity Forms - Move Progress Bar to Bottom of Form
/**
* Plugin Name: Gravity Forms: Move Progress Bar to Bottom of Form
* Plugin URI: http://www.n7studios.co.uk
* Version: 1.0.1
* Author: n7 Studios
* Author URI: http://www.n7studios.co.uk
* Description: Moves the progress bar from the top to the bottom of the Gravity Form. The Start Paging section of the form MUST have a CSS class = progress-bar-bottom
*/
/**
<?php
/**
* Gravity Perks // Populate Anything // Range Modifier for Live Merge Tags
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*
* Use the :range modifier with checkbox merge tags to get the range of checked options
* Works well with the :value modifier
*
* Will return `x - y` where the min and max are different, or `x` if they are the same