Skip to content

Instantly share code, notes, and snippets.

View anybodesign's full-sized avatar
🌴
Working in la Drôme

Thomas Villain anybodesign

🌴
Working in la Drôme
View GitHub Profile
@anybodesign
anybodesign / .css
Last active April 24, 2019 09:37
Hide some text in an accessible way
.screen-reader-text {
position: absolute;
display: block;
width: 1px;
height: 1px;
padding: 0;
margin: 0;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
@anybodesign
anybodesign / gist:ec50d08f9fbabc0882f36e56da8b4156
Last active August 26, 2018 20:33
Backward CSS compatibility of Gutenberg Gallery block
.wp-block-gallery {
display: flex;
flex-wrap: wrap;
list-style-type: none;
padding: 0;
// allow gallery items to go edge to edge
margin: 0 -8px 0 -8px;
.blocks-gallery-image,
.blocks-gallery-item {
@anybodesign
anybodesign / gist:7c93a708c49f6b127155755d82dbca28
Last active September 26, 2018 17:19
Customizer custom colors for Gutenberg color palette
// Example of custom color defined in the Customizer
$wp_customize->add_setting('primary_color', array(
'default' => '99CC00',
'sanitize_callback' => 'sanitize_hex_color',
'capability' => 'edit_theme_options',
'type' => 'theme_mod',
'transport' => 'refresh',
));
$wp_customize->add_control( new WP_Customize_Color_control($wp_customize, 'primary_color_ctrl', array(
@anybodesign
anybodesign / gist:3954ae559522aa5e41696a66198f0a8e
Last active July 6, 2018 06:23
WordPress Gutenberg Color Palette
// Define your own color palette
add_theme_support( 'editor-color-palette',
array(
'name' => __( 'very dark gray', 'textdomain' ),
'slug' => 'very-dark-gray',
'color' => '#4a4a4a',
),
array(
'name' => __( 'very light gray', 'textdomain' ),
// Facetwp A11Y Pager
function fs_a11y_facetwp_pager_html( $output, $params ) {
$output = '';
$page = $params['page'];
$total_pages = $params['total_pages'];
if ( 1 < $total_pages ) {
function fs_add_dropdown_labels() {
?>
<script>
(function($) {
$(document).on('facetwp-loaded', function() {
$('.facetwp-dropdown').each(function() {
var facet_name = $(this).parent().attr('data-name');
var facet_label = FWP.settings.labels[facet_name];
$(this).attr('id', facet_name);