Skip to content

Instantly share code, notes, and snippets.

View mustardBees's full-sized avatar

Phil Wylie mustardBees

View GitHub Profile
@mustardBees
mustardBees / functions.php
Created February 9, 2017 11:20
Convert file_list to CMB2 repeatable field groups. Go through post meta by a specified key. Convert file_list data to a CMB2 repeatable field group.
<?php
/*
Plugin Name: Convert file_list to CMB2 repeatable field groups
Plugin URI: https://www.iweb.co.uk/
Description: Go through post meta by a specified key. Convert file_list data to a CMB2 repeatable field group.
Version: 1.0.0
Author: iWeb
Author URI: https://www.iweb.co.uk/
*/
@mustardBees
mustardBees / formidable-prepopulate-from-cookie.php
Last active March 23, 2021 18:50
Prepopulate fields across forms with previously entered values.
@mustardBees
mustardBees / complex.html
Last active August 29, 2022 20:32
A little more complex BEM example
<style>
.case-studies {}
.case-studies__item {}
.case-studies__item--featured {}
.case-studies__link {}
.case-studies__image {} {}
</style>
<div class="case-studies">
<div class="case-studies__item case-studies__item--featured">
@mustardBees
mustardBees / simple.html
Last active August 29, 2022 20:44
Simple BEM example
<style>
.list {}
.list__item {}
.list__item—-red {}
</style>
<ul class="list">
<li class="list__item">List item 1</li>
<li class="list__item list__item--red">List item 2</li>
<li class="list__item">List item 3</li>
<?php
/*
Plugin Name: Convert SMURF to CMB2 repeatable field groups
Plugin URI: http://www.iweb.co.uk/
Description: Go through and zero index each SMURF array.
Version: 1.0.0
Author: iWeb
Author URI: http://www.iweb.co.uk/
*/
<?php
/**
* CMB2 Field Type: Select2 asset path
*
* Filter the path to front end assets (JS/CSS).
*/
function pw_cmb2_field_select2_asset_path() {
return get_stylesheet_directory_uri() . '/metaboxes/cmb-field-select2';
}
add_filter( 'pw_cmb2_field_select2_asset_path', 'pw_cmb2_field_select2_asset_path' );
<?php
// Example meta box field
$cmb->add_field( array(
'name' => 'Test Select',
'id' => 'test_select',
'type' => 'pw_multiselect',
'options_cb' => 'iweb_get_cmb2_term_options',
'get_terms_args' => array(
'taxonomy' => 'post_tag',
),
<?php
// Example meta box field
$cmb->add_field( array(
'name' => 'Test Select',
'id' => 'test_select',
'type' => 'pw_multiselect',
'options_cb' => 'iweb_get_cmb2_post_options',
'wp_query_args' => array(
'post_type' => 'page',
),
@mustardBees
mustardBees / pw_convert_pw_gallery_to_file_list.php
Last active February 18, 2020 16:02
Convert pw_gallery to file_list
@mustardBees
mustardBees / functions.php
Created June 29, 2015 15:38
Formidable Pro form builder - function to block email from certain domains
<?php
/**
* Block persistent marketers
*
* @param $errors
* @param $posted_field
* @param $posted_value
*
* @return mixed
*/