Skip to content

Instantly share code, notes, and snippets.

View Lovor01's full-sized avatar
🏠
Working from home

Lovro Hrust Lovor01

🏠
Working from home
  • makeITeasy
  • Zagreb
View GitHub Profile
@Lovor01
Lovor01 / functions.md
Last active February 15, 2022 11:30 — forked from rfmeier/functions.php
Sanitize callback for WordPress register_meta() function.

Sanitize callback for WordPress register_meta() function.

<?php //* do not include php tag

/**
 * Callback for WordPress register_meta() sanitize parameter.
 *
 * Sanitize the 'sample_count' meta value before saved to the database.
 *
 * @see https://codex.wordpress.org/Function_Reference/register_meta
@Lovor01
Lovor01 / block-editor-cheatsheet.js
Last active March 8, 2023 22:29 — forked from bfintal/cheatsheet.js
Block editor (Gutenberg) Cheat Sheet
// get current post categories
wp.data.select('core/editor').getEditedPostAttribute('categories')
wp.data.select('core/editor').getCurrentPostAttribute('categories')
// Get the data of a block
wp.data.select( 'core/editor' ).getBlocks()[0]
// Update attributes of another block
// wp.data.dispatch( 'core/editor' ).updateBlockAttributes( clientID, attributes )
wp.data.dispatch( 'core/editor' ).updateBlockAttributes( '10d88a6d-95d6-4e07-8293-5f59c83a26c0', { heading: 'New Heading' } )
@Lovor01
Lovor01 / core-blocks.md
Last active October 24, 2021 00:06 — forked from DavidPeralvarez/core-blocks.txt
Gutenberg core blocks list
@Lovor01
Lovor01 / .htaccess
Last active April 8, 2020 18:06 — forked from Darep/.htaccess
PHP CSS&JS auto-versioning function.
# CSS/JS auto-versioning
RewriteEngine On
RewriteRule ^(.*)\.[\d]{10}\.(css|js)$ $1.$2 [L]