Skip to content

Instantly share code, notes, and snippets.

@Kennyboy7
Kennyboy7 / gist:326505571104a0b7a77d59416298d5bf
Created February 22, 2023 18:58
Gravityforms - Green Ticks Checkbox and Radio buttons
/* Re-style Checkboxs and Radio buttons */
.gform_wrapper ul.gfield_checkbox li input[type=checkbox], .gform_wrapper ul.gfield_radio li input[type=radio] {
display: none;
margin: 0;
width: 0!important;
}
.gform_wrapper input[type=checkbox] + label, .gform_wrapper input[type=radio] + label { font-size: 16px; }
input[type=checkbox] + label:hover, input[type=radio] + label:hover { cursor: pointer; }
@Kennyboy7
Kennyboy7 / gw-gravity-forms-manual-entries.php
Created February 21, 2023 20:45 — forked from spivurno/gw-gravity-forms-manual-entries.php
Gravity Wiz // Gravity Forms // Manual Entries
<?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-manual-entries.php
*/
/**
* Gravity Wiz // Gravity Forms // Manual Entries
*
* Create entries manually for Gravity Forms. Adds an "Add New" button next to the page title on all entry-related pages.
<?php
/*
** CUSTOM LOOPER FOR PRO THEME
** 1. Set "Looper Provider" as "Custom" and the hook as "get_my_query"
** 2. Add below function to functions.php in child theme
** 3. Set Params via JSON in Pro. Takes "post_type" and "tax_query" in format here:
{
"post_type": ["post", "tv_show"],
"tax_query": {
@Kennyboy7
Kennyboy7 / xtheme_functions.php
Created August 9, 2021 19:22
X-Theme Pro Query String generator
<?
// Use this to get the correct format for a custom taxonomy to use in the Query String of a Looper
// This filter add a custom looper to get a custom post query
// its using the stadard built in WP post query structure
// add querys in the params areas and use the post_query as the hook
// Params need to be { "offset: 3"}
// Use the Post (Lists) element
add_filter( 'cs_looper_custom_post_query', function( $result, $args ) {
return get_posts( $args );
}, 10, 2);
@Kennyboy7
Kennyboy7 / gf_autoname.php
Last active August 9, 2021 19:15
GravityForms autocreate preformatted Username
<?
// Set up a GF and use a name field, this use the first and last name to create intials as part of the username
// Add this to your functions.php
// This is preformatted to produce a username that is pk_usersinitials_3 digit random number
// The username is created when the form is submitted
/ Change 3 in gform_username_3 to your form id number.
add_filter( 'gform_username_3', 'auto_username', 10, 4 );
function auto_username( $username, $feed, $form, $entry ) {
@Kennyboy7
Kennyboy7 / acf_repeater_shortcode.php
Created January 24, 2020 18:21 — forked from FranciscoG/acf_repeater_shortcode.php
An Advanced Custom Fields shortcode that allows to loop through a field with a repeater. This only handles simple cases, it can't handle nested repeater fields
<?php
/**
* ACF Pro repeater field shortcode
*
* I created this shortcode function because it didn't exist and it was being requested by others
* I originally posted it here: https://support.advancedcustomfields.com/forums/topic/repeater-field-shortcode/
*
* @attr {string} field - (Required) the name of the field that contains a repeater sub group
* @attr {string} sub_fields - (Required) a comma separated list of sub field names that are part of the field repeater group
* @attr {string} post_id - (Optional) Specific post ID where your value was entered. Defaults to current post ID (not required). This can also be options / taxonomies / users / etc