Skip to content

Instantly share code, notes, and snippets.

View cmbibby's full-sized avatar

Chris Bibby cmbibby

View GitHub Profile
@cmbibby
cmbibby / filters.php
Created July 13, 2023 11:22
Override blocks render method and replace with blade template
add_filter('render_block_core/button', function ($content, $block) {
$dom = new \DOMDocument;
$dom->loadHTML($block['innerHTML']);
$anchor = $dom->getElementsByTagName('a');
$style = [
'is-style-primary' => 'rounded-md bg-skin-fill px-3.5 py-2.5 text-sm font-semibold text-skin-inverted shadow-sm hover:bg-skin-button-accent-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600',
'is-style-link' => 'text-sm font-semibold leading-6 text-gray-900'
];
$with = [
'anchor' => $anchor[0]->nodeValue,
@cmbibby
cmbibby / blacklist-blocks.php
Last active September 30, 2022 02:00
List all registered blocks and blacklist blocks
<?php
class Blacklist_Blocks
{
public function __construct()
{
add_action('wp_body_open', array($this, 'current_blocks'));
//add_action('wp_body_open', array($this, 'all_registered_blocks'));
add_filter('allowed_block_types_all', array($this, 'blacklist_blocks'));
}
@cmbibby
cmbibby / disable-acf-links.js
Last active September 30, 2021 04:30
Disable ACF Links in the editor
@cmbibby
cmbibby / custom-woocommerce-order-status.php
Last active October 31, 2020 02:19
Add custom WooCommerce order Status
<?php
/**
*
* Register the status
*
* Note the status must start with wc-
*
*/
function my_custom_order_status($order_statuses){
@cmbibby
cmbibby / admin-dashboard.html
Last active December 11, 2019 11:42
WP Dashboard markup
<div class="wp-list-table widefat plugin-install">
<h2 class="screen-reader-text">Dashboard</h2>
<div id="the-list">
<!-- Start Card -->
<div class="plugin-card">
<div class="plugin-card-top">
<div class="name column-name">
<h3>
<a href="/wp-admin/admin.php?page=cmb-admin-training" class="">
Training Material