Skip to content

Instantly share code, notes, and snippets.

View chdenat's full-sized avatar

Christian Denat chdenat

  • Noleam
  • Saint Sauveur - France
  • 17:23 (UTC +02:00)
  • X @chdenat
View GitHub Profile
@chdenat
chdenat / FA2SL.js
Last active May 25, 2024 13:15
JavaScript Class to help you to use Font Awesome Icons (6.5+) into Shoelace (2.0+)
import {findIconDefinition, icon, library} from '@fortawesome/fontawesome-svg-core'
import {registerIconLibrary} from '@shoelace-style/shoelace'
/**
* This class is used to insert font awesome icons (version 6.5 and higher) into Shoelace web components.
*
* Font Awesome : https://fontawesome.com
* Shoelace : https://shoelace.style
*
* Usage:
@chdenat
chdenat / Hook for ACF CSS
Last active July 6, 2021 17:54
Some CSS used to overload admin page. Use *force-left* class in ACF to force a new line and *left-xx* class to make some spacing.
add_action( 'acf/input/admin_head', function () {
// Assume to be in <plugin>/css/acf-addon.css
wp_enqueue_style( 'acf-addon', plugins_url( '/css/acf-addon.css', __FILE__ ), [
'acf-input',
'acf-pro-input',
] );
} );
@chdenat
chdenat / Add an empty method to ACF Repeater
Last active May 26, 2021 17:13
There was no method to clear all the rows of a repeater ... This is a new Field prototype method
/**
* empty function for acf.Field ie, it clears all the existing rows
*
* Only for repeater
*
* @returns {boolean}
*
* @author : Christian Denat
* @email : [email protected] / [email protected]
*
@chdenat
chdenat / ACF Repeater creation
Last active May 26, 2021 17:14
Row creation in Javascript is easy ...
/**
* Use this gist to add a row in a repeater field and retrieve all the sub fields you can manage later.
*
* @author : Christian Denat
* @email : [email protected] / [email protected]
*
* @date : 20210525
*
*/