Skip to content

Instantly share code, notes, and snippets.

mattetc

Block or report user

Report or block mattetc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cristacheda
cristacheda / Advanced Custom Fields repeater values to a Gravity Forms dropdown field.md
Last active Oct 26, 2019
Populate Gravity Forms dropdown field with Advanced Custom Fields repeater values.
View Advanced Custom Fields repeater values to a Gravity Forms dropdown field.md

Add Advanced Custom Fields repeater values to a Gravity Forms dropdown field

The code should be added in a separate file and then included in your functions.php using require.

Replace 1 from the code with the ID of the form that you want to dinamically populate with field values from ACF. You can find more info about the filters in the Gravity Forms documentation.

add_filter( 'gform_pre_render_1', 'populate_dropdown' );
add_filter( 'gform_pre_validation_1', 'populate_dropdown' );
add_filter( 'gform_admin_pre_render_1', 'populate_dropdown' );
add_filter( 'gform_pre_submission_filter_1', 'populate_dropdown' );
@FranciscoG
FranciscoG / acf_repeater_shortcode.php
Last active Nov 1, 2019
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
View acf_repeater_shortcode.php
<?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
@nikolov-tmw
nikolov-tmw / multiple-roles-per-user.php
Last active Nov 9, 2019
Multiple roles per user WordPress plugin.
View multiple-roles-per-user.php
<?php
/**
* Plugin Name: Multiple Roles per User
* Description: Allows anyone who can edit users to set multiple roles per user. In a default WordPress environment that wouldn't have much of an effect, since the user would have the privileges of the top-privileged role that you assign to him. But if you have custom roles with custom privileges, this might be helpful.
* Version: 1
* Author: nikolov.tmw
* Author URI: http://paiyakdev.com/
* License: GPL2
*/
/*
@BigglesZX
BigglesZX / jQuery.Adjacent.Wrapping.htm
Created Dec 19, 2010
Wrap two adjacent elements in a containing div using jQuery
View jQuery.Adjacent.Wrapping.htm
This is a useful trick if you want to wrap two sibling elements in a containing element, for example to fix stupid float bugs in IE7. I had a bit of a time figuring out how to select the right elements (wrapping is easy enough with one element, or one element's children), so I thought I'd share for the Greater Good.
From markup like this:
<div class='form-container'>
...
<div class='form-label'>Name (required)</div>
<div class='form-field'><input type="text" name="you-name" value="" class="textbox" size="30" maxlength="200" /></div>
<div class='form-label'>Email (required)</div>
You can’t perform that action at this time.