Skip to content

Instantly share code, notes, and snippets.

View geekontheroad's full-sized avatar

geekontheroad

View GitHub Profile
@geekontheroad
geekontheroad / gf-custom-merge-tags.php
Last active July 12, 2021 03:18 — forked from uamv/gf-custom-merge-tags.php
Add custom merge tags to Gravity Forms
<?php
add_filter( 'gform_replace_merge_tags', 'gotrcustom_merge_tags', 10, 7 );
function gotr_custom_merge_tags( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format ) {
$custom_merge_tags = array(
'{date_ymd}' => date( 'Y.m-M.d', strtotime( $entry['date_created'] ) ),
'{timestamp}' => time(),
'{site_url}' => get_site_url(),
'{site_name}' => get_bloginfo( 'name' )
@geekontheroad
geekontheroad / woo-events.js
Created October 14, 2021 14:30 — forked from bagerathan/woo-events.js
[Woocommerce Javascript events] #woo
//Woocommerce Checkout JS events
$( document.body ).trigger( 'init_checkout' );
$( document.body ).trigger( 'payment_method_selected' );
$( document.body ).trigger( 'update_checkout' );
$( document.body ).trigger( 'updated_checkout' );
$( document.body ).trigger( 'checkout_error' );
//Woocommerce cart page JS events
$( document.body ).trigger( 'wc_cart_emptied' );
$( document.body ).trigger( 'update_checkout' );
@geekontheroad
geekontheroad / gravity-forms-load-previous-entry.php
Last active January 10, 2022 15:44
Gravity forms: Load the previous entry of a logged in user into a gravity forms
<?php
/**
* Function that will prepopulate the previous logged-in user entry
*
*@author Johan De Reiziger
*@link <https://geekontheroad.com>
*/
@geekontheroad
geekontheroad / prepopulate-id.php
Last active January 22, 2022 03:10
This script will pre populate all fields with their field ID
<?php
/**
* This function will prefill every field with its Field ID number
* Email, address and phone fields are also supported
* Radio buttons will select its first option by default.
*
* Change the number 8 below to the number of your form. eg: gform_pre_render_FORMID
*
*@author Johan De Reiziger
*@link https://geekontheroad.com
@geekontheroad
geekontheroad / php-html-css-js-minifier.php
Created February 6, 2022 09:04 — forked from Rodrigo54/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
/**
* This CSS snippet is meant to force the correct alignment for the Live summary for Gravity Forms plugin
*
* For plugin: https://geekontheroad.com/live-summary-for-gravity-forms
* @author Johan d'Hollander
***/
.gotrgf_form_overview_container > .gotrgf_summary_lines > .gotrgf_summary_line > .gotrgf_line_part_left {
text-align: left !important;
width: 40% !important;
@geekontheroad
geekontheroad / gravity-forms-limit-radio-buttons.js
Last active June 4, 2022 05:35
This small jQuery snippet for gravity forms will de-select all other radio button choices. (with the same class) Essentially this makes different radio buttons work together and it makes sure that only one radio button over different radio fields can be selected
/**
* This small jQuery snippet will de-select all other radio button choices. (with the same class)
* Essentially this makes different radio buttons work together and it makes sure that only one radio button over different radio fields can be selected
*
* INSTRUCTIONS
* Add the css class "gotr_limit_radio" to any radio field that needs this feature.
* Copy the below snippet into a html field and wrap it between <script> Snippet goes Here </script>
* Save the form.
*
* Update 04/06/2022
/**
* This snippet will add a datepicker to the list field of Gravity Forms.
* Just copy paste this snippet and complete the configuration at the bottom
* Also make sure that Jquery UI is loaded otherwise this won't work (<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>)
*
* @author Johan d'Hollander
* @link <https://geekontheroad.com>
**/
jQuery(document).ready(function() {
<?php
/**
* Class to add row action link to GF entries list table.
*
* @package BDFGF\Helpers
*/
namespace BDFGF\Helpers;
/**
@geekontheroad
geekontheroad / wp_all_enqueued_css_shortcode.php
Last active May 14, 2023 06:32
Adds a new shortcode that will output a list of all CSS that is loaded for that page with their handle and file location.
<?php
/**
* This will output all styles with their handle and file location
*
* Shortcode: [gotr_enqueued_css]
*
* @author https://geekontheroad.com
***/
function gotr_enqueued_css_shortcode() {