Skip to content

Instantly share code, notes, and snippets.

@BigglesZX
BigglesZX / jQuery.Adjacent.Wrapping.htm
Created December 19, 2010 17:17
Wrap two adjacent elements in a containing div using jQuery
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>
@nikolov-tmw
nikolov-tmw / multiple-roles-per-user.php
Last active September 5, 2024 01:45
Multiple roles per user WordPress plugin.
<?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
*/
/*
@ronalfy
ronalfy / soliloquy-overlay.css
Created May 4, 2016 18:16
Soliloquy Background Overlay
.soliloquy-item:before {
display: block;
content: '';
width: 100%;
height: 100%;
position: absolute;
right: 0;
top: 0;
z-index: 9;
background: #212121;
@FranciscoG
FranciscoG / acf_repeater_shortcode.php
Last active October 28, 2024 06:16
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
@cristacheda
cristacheda / Advanced Custom Fields repeater values to a Gravity Forms dropdown field.md
Last active August 26, 2022 03:47
Populate Gravity Forms dropdown field with Advanced Custom Fields repeater values.

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' );