Skip to content

Instantly share code, notes, and snippets.

View schemapress's full-sized avatar

Schema.Press schemapress

View GitHub Profile
@apisandipas
apisandipas / _dashicons.scss
Last active October 17, 2024 06:07
Dashicons Mixin for Wordpress Admin
/**
* Dashicons SCSS Mixin for Custom Post Type Icons in WordPress 3.8+
*
* 1. In your CPT register_post_type function, set " 'menu_icon' => '', "
* 2. This will make the class for your admin icon .menu-icon-{slug for Custom Post Type name}
* 3. Load a compiled scss stylesheet at wp_head:
*
* function add_menu_icons_styles(){
* wp_enqueue_style( 'screen', get_template_directory_uri() . '/css/dashicons.css', array(), '0.1.0', 'all' );
* }
@llemurya
llemurya / wordpress_dashicons_array.php
Last active January 27, 2023 11:44
WordPress dashicons array
<?php
$dashicons = array(
'dashicons-menu',
'dashicons-dashboard',
'dashicons-admin-site',
'dashicons-admin-media',
'dashicons-admin-page',
'dashicons-admin-comments',
'dashicons-admin-appearance',
'dashicons-admin-plugins',
@Shelob9
Shelob9 / serve-side-block.js
Last active February 4, 2024 20:38
Example Gutenberg block with server-side rendering. Gutenberg edit() block creates interface. Gutenberg saves settings automatically, the PHP function passed as `render_callback` to `register_block_type` is used to create HTML for front-end rendering of block.
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
const el = wp.element.createElement;
registerBlockType( 'hiRoy/serverSide', {
title: __( 'Server Side Block', 'text-domain' ),
icon: 'networking',
category: 'common',
attributes: {