Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Register custom block template
*
* @return void
*/
function prefix_register_block_templates() {
// Theme pattern example:
<pre><code class="language-typescript">
import { faker } from "@faker-js/faker";
const attachmentBlueprint = async (data?: Partial<Attachment>) => {
const messageId = data?.messageId ?? (await messageBlueprint()).id;
return await prisma.attachment.create({
data: {
messageId,
filename: faker.system.fileName(),
<?php
/**
* Font variable overrides
*
* @package Wpdev\FontOverrides
*/
namespace Wpdev\FontOverrides;
/**
@bacoords
bacoords / enqueue.php
Created April 17, 2024 21:34
example enqueue
<?php
/**
* Enqueue block editor assets.
*
* @return void
*/
function enqueue_custom_block_editor_modifications() {
$asset_file = include PLUGIN_PATH . '/build/editor-modifications/index.asset.php';
wp_enqueue_script(
<?php
/**
* Register block styles.
*
* @return void
*/
function prefix_register_block_styles() {
$site_icon = get_site_icon_url();
if ( $site_icon ) {
<?php
/**
* Custom login page design
*/
function custom_login_page_design() {
$colors = wp_get_global_styles( array( 'color' ) );
$variables = wp_get_global_stylesheet( array( 'variables' ) );
?>
<style type="text/css">
<script type="text/javascript">
document.querySelectorAll('.consent-link').forEach(el => {
el.addEventListener('click', event => {
if(! Osano) {
return
}
event.preventDefault();
Osano.cm.showDrawer();
})
})
<?php
/**
* Render columns block with extra class
*
* @param string $block_content The block content about to be rendered.
* @param array $block The full block, including name and attributes.
* @return string
*/
function render_columns_block_class( $block_content, $block ) {
@bacoords
bacoords / social-icons.php
Last active November 17, 2023 15:35
Filter the social icons block.
<?php
/**
* Filter the social icons block.
*
* @param string $block_content The block content.
* @param array $block The block.
*
* @return string
*/
function filter_social_icons_block( $block_content, $block ) {
@bacoords
bacoords / twitter-font-awesome-4.css
Last active May 2, 2024 21:41
Update the Twitter / X Icon in Font Awesome 4
.fa.fa-twitter{
font-family:sans-serif;
}
.fa.fa-twitter::before{
content:"𝕏";
font-size:1.2em;
}