Skip to content

Instantly share code, notes, and snippets.

@bradpotter
bradpotter / add-editor-layout-classes.js
Created April 7, 2019 07:26 — forked from nickcernis/add-editor-layout-classes.js
Add Genesis layout class to Gutenberg editor pages (admin)
// Add genesis layout classes to the Block Editor.
// File lives in the theme's /js/ folder.
wp.domReady(function () {
yourTheme.updateLayoutClass();
var layouts = document.querySelector(".genesis-layout-selector");
layouts.addEventListener("input", function (e) {
yourTheme.updateLayoutClass();
});
});
@nickcernis
nickcernis / functions.php
Created January 16, 2019 11:11
Wrap Custom HTML WordPress blocks in a div wrapper
<?php
add_filter( 'render_block', 'custom_wrap_html_block_output', 10, 2 );
/**
* Wrap output of HTML blocks.
*
* @param string $block_content Original block content.
* @param array $block Block info.
* @return string The block content with a wrapper.
*/
@nickcernis
nickcernis / add-editor-layout-classes.js
Last active February 20, 2020 09:09
Add Genesis layout class to Gutenberg editor pages (admin)
// Add genesis layout classes to the Block Editor.
// File lives in the theme's /js/ folder.
wp.domReady(function () {
yourTheme.updateLayoutClass();
var layouts = document.querySelector(".genesis-layout-selector");
if( layouts ) {
layouts.addEventListener("input", function (e) {
yourTheme.updateLayoutClass();