Skip to content

Instantly share code, notes, and snippets.

View derweili's full-sized avatar

Julian Weiland derweili

  • Germany
  • 12:20 (UTC +02:00)
View GitHub Profile
@derweili
derweili / disable-acf-blocks-on-edit.js
Last active April 29, 2022 17:09
Disable Links in ACF Block-Edit Method
/*
* Wrap all ACF Blocks in Disabled block to disable all links in edit view
*/
const { createHigherOrderComponent } = wp.compose;
const { Fragment } = wp.element;
import { Disabled } from '@wordpress/components';
const withDisabledCompontent = createHigherOrderComponent( ( BlockEdit ) => {
return ( props ) => {
@derweili
derweili / block-string-list-block.js
Created July 24, 2019 09:41
Example Gutenberg Block with array attribute
/**
* BLOCK: string-list-block
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
// Import CSS.
import './style.scss';
import './editor.scss';
@derweili
derweili / removeStylesFromHtmlMarkup.php
Created January 25, 2024 16:35
removeStylesFromHtmlMarkup.php
function removeStylesFromHtmlMarkup($markup) {
function removeElementsByTagName($tagName, $document) {
$nodeList = $document->getElementsByTagName($tagName);
for ($nodeIdx = $nodeList->length; --$nodeIdx >= 0; ) {
$node = $nodeList->item($nodeIdx);
$node->parentNode->removeChild($node);
}
}