Skip to content

Instantly share code, notes, and snippets.

View alinademi's full-sized avatar

Ali Demi alinademi

  • Vancouver
View GitHub Profile
@denvercoder
denvercoder / roots
Last active December 18, 2025 19:21
My script to setup Roots.io Bedrock and Sage alongside Local by Flywheel
#!/bin/bash
cd ~/Local\ Sites/$1/app/
echo Installing Bedrock... Please Wait
composer create-project roots/bedrock
rm -rf public
<?php
/*
* Plugin Name: WP REST API Demo
* Plugin URI: https://gist.github.com/wpscholar/693517420ca6c9e29e7719ef24e7e00f
* Description: A developer plugin designed for playing around with the WordPress REST API.
* Version: 1.0
* Author: Micah Wood
* Author URI: https://wpscholar.com
* License: GPL2
@MelMacaluso
MelMacaluso / expose_ACF_fields_to_REST.php
Created June 4, 2019 22:54
Automatically expose all the ACF fields to the Wordpress REST API in Pages and in your custom post types.
<?php
function create_ACF_meta_in_REST() {
$postypes_to_exclude = ['acf-field-group','acf-field'];
$extra_postypes_to_include = ["page"];
$post_types = array_diff(get_post_types(["_builtin" => false], 'names'),$postypes_to_exclude);
array_push($post_types, $extra_postypes_to_include);
foreach ($post_types as $post_type) {
register_rest_field( $post_type, 'ACF', [
@megclaypool
megclaypool / Block Names.md
Last active August 16, 2021 00:50
[Setting up custom GUI style options for blocks in WP Gutenberg] Bill Erickson's [Block Styles in Gutenberg](https://www.billerickson.net/block-styles-in-gutenberg/) see Contra Costa backend for example :)

List of block names You need to know the full block name in order to attach or remove styles from it. Here’s a list of all the core blocks (excluding all the embed ones):

core/paragraph
core/image
core/heading
core/gallery
core/list
core/quote
core/audio

@arturmartins
arturmartins / mac-upgrade.sh
Last active December 30, 2025 16:04
How to keep your mac software updated easily (2026)
#!/bin/bash
# Requirements:
# - homebrew: https://brew.sh/
# - homebrew tap: buo/cask-upgrade - https://github.com/buo/homebrew-cask-upgrade
# - homebrew mas (Mac App Store command-line interface - https://github.com/mas-cli/mas)
#
# Install the requirements by running:
# brew tap buo/cask-upgrade && brew install mas
# CONFIG:
@jenssogaard
jenssogaard / ACF Gutenberg get block fields
Created February 22, 2019 21:08
Helper class for ACF and Gutenberg. Get blocks fields by passing block_id and post_id.
<?php
namespace JensSogaard;
class BlockHelper
{
/**
* Gets ACF fields for a specific block on a given post
* @author Jens Soegaard <[email protected]>
*/
public function getBlockFromPage(string $block_id, int $post_id)
@alexciarlillo
alexciarlillo / custom.json
Created November 30, 2018 22:34
VSCode customizations for Nord color theme
// color customizations for Nord
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"settings": {
"foreground": "#d1d5dc",
"background": "#2f343f"
}
},
{
<?php
class MyTheme
{
private function actionAfterSetup($function)
{
add_action('after_setup_theme', function() use ($function) {
$function();
});
}
@airyboy
airyboy / keybindings.json
Created November 8, 2018 06:50
entries to use alt+j, alt+k for intellisense in VSCode
{
"key": "alt+k",
"command": "selectNextSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "alt+j",
"command": "selectPrevSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
}
@mahlamusa
mahlamusa / extend-wp-rest-api.php
Last active June 1, 2023 10:38
Extend WordPress REST API with custom rest fields and endpoints
<?php
/**
* Register custom rest fields
*/
add_action( 'rest_api_init', 'register_custom_fields' );
/**
* Register rest fields and endpoint
*