Skip to content

Instantly share code, notes, and snippets.

View krstivoja's full-sized avatar
:bowtie:
Working on something exciting

Marko Krstic krstivoja

:bowtie:
Working on something exciting
View GitHub Profile
@cvan
cvan / debug-tailwind.md
Created February 16, 2023 04:55
debug tailwind

show me all the Tailwind CSS classes to use in my project

which CSS selectors to use? this shows all the (non-dynamic) options generated from your project's tailwind.config.js.

rogden/tailwind-config-viewer is the best. run from the command line:

npx tailwind-config-viewer -o 
/**
* Block Editor Settings.
* Add custom colors and gradients to the editor.
*/
function tabor_add_colors_and_gradients() {
$colors = array(
'primary' => '#db1c7d',
'secondary' => '#a528f0',
'tertiary' => '#90cbff',
function tabor_register_block_categories() {
if ( class_exists( 'WP_Block_Patterns_Registry' ) ) {
register_block_pattern_category(
'hero',
array( 'label' => _x( 'Hero', 'Block pattern category', 'textdomain' ) )
);
}
}
@yankiara
yankiara / oxygen-media-breakpoints-buttons.css
Last active January 28, 2021 20:53
Direct access to Oxygen's media breakpoints
.oxygen-media-query-box-wrapper {
position: static;
}
.oxygen-sidebar-currently-editing {
position: relative;
padding-bottom: 48px;
}
.oxygen-media-query-box {
display: none;
}
function block_variation_example_enqueue() {
wp_enqueue_script(
'block-variation-example-script',
plugins_url( 'index.js', __FILE__ ),
array( 'wp-blocks', 'wp-dom-ready', 'wp-edit-post' ),
filemtime( plugin_dir_path( __FILE__ ) . '/block-variation-example.js' )
);
}
add_action( 'enqueue_block_editor_assets', 'block_variation_example_enqueue' );
wp.domReady( function() {
wp.blocks.registerBlockVariation( 'coblocks/form', {
name: 'event-registration',
title: 'Event Registration',
icon: '<svg height="48" viewBox="0 0 48 48" width="48" xmlns="http://www.w3.org/2000/svg"><path d="m18 10h-14v2h14zm2-8h-1v-2h-2v2h-12v-2h-2v2h-1c-1.11 0-1.99.9-1.99 2l-.01 16c0 1.1.89 2 2 2h18c1.1 0 2-.9 2-2v-16c0-1.1-.9-2-2-2zm0 18h-18v-13h18zm-5-5h-6-5v2h11z" transform="translate(13 14)"/></svg>',
innerBlocks: [
[ 'coblocks/field-name', { label: 'Full name', hasLastName: true } ],
[ 'coblocks/field-email', { required: true } ],
[ 'coblocks/field-radio', { label: 'How do you use WordPress?', required: true, options: [ 'I write', 'I design', 'I develop', 'I manage', 'I am new to WordPress!'] } ],
[ 'coblocks/field-checkbox', { label: 'I’m on a gluten-free diet', options: [ 'Yes', 'No' ], required: true } ],
@yankiara
yankiara / oxygen-repeater-dynamic-query.php
Last active September 6, 2023 19:25
Use dynamic queries with Oxygen's repeater
/* I'll put here different examples of dynamic query for Oxygen repeater :
* - Use one of the following repeater_dynamic_query definitions
* in code block just BEFORE the repeater
* - Set the repeater custom query settings : post type, number of posts, order...
* - Add the remove_action in a code block AFTER the repeater
*/
/****************************************************************************************************
* Display related posts for any CPT with taxonomy:
/**
* Add Oxygen's global colors to Gutenberg's backend editor palette
*/
function pavenum_gutenberg_oxygen_palette() {
$gutenberg_colors = [];
$oxy_colors = oxy_get_global_colors();
foreach( $oxy_colors['colors'] as $oxy_color) {
$gutenberg_colors[] = [ 'name' => $oxy_color['name'], 'slug' => 'color-' . $oxy_color['id'], 'color' => $oxy_color['value'] ];
@brickbones
brickbones / wordpress-page-temaplate.php
Created April 20, 2019 18:07
WordPress page template with API (javascript and php)
<?php /* Template Name: Awesome Page */
get_header();
?>
<div class="latest-posts"></div>
<script>
<?php
if ( has_block( 'blockgallery/masonry' ) ) {
// Do something, if the Block Gallery Masonry block is added to this page.
}