Skip to content

Instantly share code, notes, and snippets.

View elliotcondon's full-sized avatar

Elliot Condon elliotcondon

View GitHub Profile
<?php
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if( ! class_exists('ACF_Media') ) :
class ACF_Media {
/**
* Constructor.
@elliotcondon
elliotcondon / acf-meta-functions.php
Last active November 3, 2020 00:09
ACF 5.9.3 Hotfix
<?php
/**
* acf_get_meta
*
* Returns an array of "ACF only" meta for the given post_id.
*
* @date 9/10/18
* @since 5.8.0
*
@elliotcondon
elliotcondon / functions.php
Created October 11, 2020 22:37
ACF Blocks JS Test
<?php
add_action('acf/init', 'my_acf_blocks_init');
function my_acf_blocks_init() {
acf_register_block_type(array(
'name' => 'test-js',
'title' => __('Test JS'),
'description' => __('A block for testing JS.'),
'render_template' => 'template-parts/blocks/test-js/test-js.php',
@elliotcondon
elliotcondon / gist:a792f9adf3831f65e3dfdbeb14f912d2
Created March 4, 2019 03:20
ACF PRO 5.7.12 - Fixed bug where newly added metabox is not visible in Gutenberg
// Do nothing.
@elliotcondon
elliotcondon / gist:f0f3141f34d1e57fc55387574c49262c
Last active February 13, 2022 14:42
A Closer Look at Applying Filter Variations in ACF.
function acf_get_value( $post_id, $field ) {
// Load meta value.
$value = acf_get_metadata( $post_id, $field['name'] );
/**
* Filters the $value after it has been loaded.
*
* @date 28/09/13
* @since 5.0.0
@elliotcondon
elliotcondon / functions.php
Last active March 31, 2017 16:00
Custom wordpress.org plugin download list
<?php
/*
* get_my_plugin_downloads
*
* This function will return an array of plugin download information
*
* @type function
* @date 31/3/17
* @since 5.5.10
Hi guys
There is a JS error preventing the 'duplicate' checkbox from displaying the 'Duplicate' button when editing a post.
The JS error can be found in the file 'res/js/scripts.js' on line 27
Please change:
```
if(jQuery('#post ').find('input[name="icl_dupes[]"]:checked'.length > 0)){
```
function my_acf_init_settings() {
//acf_update_setting('enqueue_google_maps', false);
//acf_update_setting('enqueue_select2', false);
//acf_update_setting('select2_version', 4);
}
add_action('acf/init', 'my_acf_init_settings');
/*
* check_sync
*
* This function will check for any $_GET data to sync
*
* @type function
* @date 9/12/2014
* @since 5.1.5
*
* @param n/a
@elliotcondon
elliotcondon / gist:c94abec50dc26ac065c6
Last active January 26, 2023 20:09
WooCommerce 'Create variations from all attributes' randomisation fix
<?php
/*
* array_cartesian
*
* This function will fix a frustrating issue in the WooCommerce plugin
* When adding a product using variations, you will most likely use the 'Create variations from all attributes' function
* The issue with this function is that it will create the variations in a random order
* This is frustrating for your clients to edit
*