Skip to content

Instantly share code, notes, and snippets.

View misfist's full-sized avatar

P. E. A. Lutz misfist

  • NYC
View GitHub Profile
@misfist
misfist / boukman_enqueue_scripts
Created December 9, 2016 19:19
Updated enqueue
function boukman_enqueue_scripts() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', trailingslashit( get_template_directory_uri() ) . 'js/jquery-1.8.0.min.js', null, null, false );
wp_enqueue_style( 'style-11-23-16', trailingslashit( get_template_directory_uri() ) . 'style-11-23-16.css', null, null, false );
wp_enqueue_style( 'overrides', trailingslashit( get_template_directory_uri() ) . 'overrides.css', null, null, false );
wp_enqueue_style( 'lifetime', trailingslashit( get_template_directory_uri() ) . 'lifetime.css', null, null, false );
wp_enqueue_style( 'fundraiser', trailingslashit( get_template_directory_uri() ) . 'fundraiser.css', null, null, false );
wp_enqueue_style( 'abcs', trailingslashit( get_template_directory_uri() ) . 'abcs.css', null, null, false );

Keybase proof

I hereby claim:

  • I am misfist on github.
  • I am misfist (https://keybase.io/misfist) on keybase.
  • I have a public key whose fingerprint is 82AD 62AA C3E0 BFF2 834E FA24 DD95 7339 BB45 EBF0

To claim this, I am signing this object:

# Ignore everything #
**
!wp-content/
wp-content/**
!wp-content/themes/
!wp-content/plugins/
wp-content/themes/**
wp-content/plugins/**
# Add two rules for each Theme or Plugin you want to include:
/**
* Add the field "spaceship" to REST API responses for posts read and write
*/
add_action( 'rest_api_init', 'slug_register_spaceship' );
function slug_register_spaceship() {
register_rest_field( 'post',
'starship',
array(
'get_callback' => 'slug_get_spaceship',
'update_callback' => 'slug_update_spaceship',
function bidirectional_acf_update_value( $value, $post_id, $field ) {
// vars
$field_name = $field['name'];
$global_name = 'is_updating_' . $field_name;
// bail early if this filter was triggered from the update_field() function called within the loop below
// - this prevents an inifinte loop
if( !empty($GLOBALS[ $global_name ]) ) return $value;
@misfist
misfist / shortcake-ui-demo.php
Created April 13, 2016 19:20
ShortCake UI Demo Plugin
<?php
/**
* Plugin Name: Shortcake UI Pullquote Demo
* Plugin URI:
* Description: Try Shortcake with pull-quite shortcode
* Version: 1.0.0
* Author: Mte90
* License: GPL2
*/
@misfist
misfist / .gitignore
Created October 27, 2015 02:44 — forked from salcode/.gitignore
WordPress .gitignore - this is my preferred gitignore file when working with WordPress. It ignores almost all files by default.
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20150227
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@misfist
misfist / include_cpt_in_rest_api
Created September 22, 2015 16:21
Add custom post type to Rest API
register_post_type('service',
array(
'labels' => array(
'name' => __('Services'),
'singular_name' => __('service')
),
'public' => true,
'has_archive' => true,
'show_in_rest' => true, //Adds the custom post type to the rest api
)
@misfist
misfist / functions.php
Created September 22, 2015 16:17 — forked from yoren/functions.php
Add Featured Image Thumbnail URL to wp-json/wp/v2/posts Endpoint
<?php
function my_rest_prepare_post( $data, $post, $request ) {
$_data = $data->data;
$thumbnail_id = get_post_thumbnail_id( $post->ID );
$thumbnail = wp_get_attachment_image_src( $thumbnail_id );
$_data['featured_image_thumbnail_url'] = $thumbnail[0];
$data->data = $_data;
@misfist
misfist / forEachCreateButton.js
Created September 10, 2015 15:20
Create a button for each element in an array
function createButtons(element, index) {
var button = document.createElement("button");
button.id = element;
button.innerHTML = element;
controlpanel.appendChild(button);
}
["Play", "Pause", "Mute"].forEach(createButtons);