Skip to content

Instantly share code, notes, and snippets.

View davidallenlewis's full-sized avatar

David Lewis davidallenlewis

  • Halifax, NS. Canada
View GitHub Profile
/*
state.selectedFilters could be empty
state.selectedFilters could NOT be empty and
- Clicked taxonomy (queryVar) is already an object in the state.selectedFilters array
Look for the clicked term in the matched object
If the term is in there remove it, otherwise add it
- Clicked taxonomy is NOT already in the state.selectedFilters array
Create a new object to add to state.selectedFilters i.e. { queryVar, selectedTerms: [blah, blah] }
@davidallenlewis
davidallenlewis / edit.js
Last active March 24, 2025 17:38
Get ACF metadata into the Block Editor
/**
* WordPress dependencies
*/
import { addFilter } from '@wordpress/hooks';
import { createHigherOrderComponent } from '@wordpress/compose';
import { Fragment } from '@wordpress/element';
import { useEntityProp } from '@wordpress/core-data';
/**
* Add controls to the block editor
@davidallenlewis
davidallenlewis / pdf-viewer-for-wpdf-patches.php
Last active September 23, 2024 12:57
Patches for Pdf Viewer For WP Display Files version 1.0.5 by WePlugins
// @PATCH for /wp-content/plugins/pdf-viewer-for-wpdf/assets/js/wpdf-pdf-viewer.js on line 16
// Allows PDFs to render in higher resolution so they are not too blurry to read
//scale = 1,
scale = 3,
// @PATCH for /wp-content/plugins/pdf-viewer-for-wpdf/pdf-viewer-for-wpdf.php
// @HACK by David Lewis - add timestamp to URLs to prevent browser caching of same-named files
// Line 77
//<li><a href="javascript:void(0);" class="display_pdf_file" data-pdf-url = '.$download_url.' ></a></li>
@davidallenlewis
davidallenlewis / wp-display-files-patches.php
Last active September 23, 2024 14:18
Patches for WP Display Files Plugin version Version 4.0.8 from WePlugins
<?php
/* @PATCH
* /inc/listing/class-wpdf-downloader.php on line 52
* Allows shortcode files to download properly when a user has multiple roles or one role that is not zero-indexed
*/
// @HACK by David Lewis start
$current_user_info = wp_get_current_user();
$user_id = $current_user_info->data->ID;
@davidallenlewis
davidallenlewis / social-link-custom-icons.js
Last active February 13, 2025 20:31
Add custom icons to Social Link Block (Editor)
@davidallenlewis
davidallenlewis / social-link-custom-icons.php
Last active February 13, 2025 20:35
Add custom icons to Social Link Block (Front End)
@davidallenlewis
davidallenlewis / quote-variation-full.js
Created December 15, 2023 16:52
core/quote Variation (full)
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { registerBlockVariation } from '@wordpress/blocks';
import { RichText } from '@wordpress/block-editor';
import { useEntityProp } from '@wordpress/core-data';
import { addFilter } from '@wordpress/hooks';
const { createHigherOrderComponent } = wp.compose;
@davidallenlewis
davidallenlewis / quote-variation.js
Last active December 15, 2023 16:41
core/quote Block Variation
import { registerBlockVariation } from '@wordpress/blocks';
import { addFilter } from '@wordpress/hooks';
const VARIATION_NAME = 'allswater/custom-quote-test';
registerBlockVariation( 'core/quote', {
name: VARIATION_NAME,
title: 'Quote Variation',
//isActive: [ namespace, authorCredentials ],
isActive: ( { namespace, authorCredentials } ) => {
<div class="custom-homepage-hero-bg-overlay" style="background-image:
url(https://rps.charcoal.website/wp-content/uploads/2021/05/rps-arrow-fixed.png);
background-size: cover !important;
background-position: top right !important;">
</div>
<video class="custom-homepage-hero-bg" src="https://rps.charcoal.website/wp-content/uploads/2021/03/iStock-1175940323.mp4" autoplay loop playsinline muted>
</video>
<div class="custom-homepage-hero">
<div class="homepage-slider-container hidden">
@davidallenlewis
davidallenlewis / CANImmunize.css
Last active August 29, 2022 18:45
Hide Inactive Appointment Locations in CANImmunize
/* Remove extra spacing from all cards */
.card[appointment][class*="styles_appointmentTypeCard__"] {
margin: 0 !important;
border-top: 0 !important;
border-bottom: 0 !important;
}
/* Add bottom spacing back to visible cards */
.card[appointment][class*="styles_appointmentTypeCardSelectable__"] {
margin-bottom: 10px !important;