Skip to content

Instantly share code, notes, and snippets.

View mkokes's full-sized avatar

Marty Kokes mkokes

View GitHub Profile
@claygriffiths
claygriffiths / resize_local_machine.sh
Last active November 6, 2020 03:45 — forked from joost/resize_boot2docker.sh
Resize Local by Flywheel VirtualBox image
# Steps we will take:
# 1. Change Local (Docker Machine) image type (this will take a bit)
# 2. Resize image
# 3. Resize partion
#
# Also see: https://docs.docker.com/articles/b2d_volume_resize/
# IMPORTANT: Make sure Local is not running!
VM_NAME="local-by-flywheel"
NEW_DISK_SIZE=50000
@spivurno
spivurno / gp-unique-id-retroactively-populate-unique-ids.php
Created September 23, 2016 15:48
Gravity Perks // GP Unique ID // Retroactively Populate Unique IDs
<?php
/**
* Gravity Perks // GP Unique ID // Retroactively Populate Unique IDs
* https://gravitywiz.com/documentation/gp-unique-id/
*
* 1. Copy and paste this code into your theme's functions.php file.
* 2. Go to your home page and add the following parameters to the query string:
*
* gpui_retro_pop=1
* form_id=123
var Subject = function() {
this.observers = [];
return {
subscribeObserver: function(observer) {
this.observers.push(observer);
},
unsubscribeObserver: function(observer) {
var index = this.observers.indexOf(observer);
if(index > -1) {
@soderlind
soderlind / dropzonejs-wp-rest-api-custom-endpoint.js
Created February 1, 2016 19:33
DropzoneJS & WordPress REST API with Custom Endpoint
// dropzoneWordpressRestApiForm is the configuration for the element that has an id attribute
// with the value dropzone-wordpress-rest-api-form (or dropzoneWordpressRestApiForm)
Dropzone.options.dropzoneWordpressRestApiForm = {
//acceptedFiles: "image/*", // all image mime types
acceptedFiles: ".jpg", // only .jpg files
maxFiles: 1,
uploadMultiple: false,
maxFilesize: 5, // 5 MB
init: function() {
console.group('dropzonejs-wp-rest-api:');
@danshumaker
danshumaker / p-connect.sh
Last active April 16, 2018 16:27 — forked from aaronbauman/p-connect.sh
Connect to a Pantheon database in Sequel Pro
#!/bin/sh
# Dan Shumaker modified&added features:
# 1. Use terminus instead of drush
# 2. Save standard options (if user wants to they can save their settings on lines 14-18 and not have to have any cli options)
# 3. Auto generate standard live,test,dev enviornment files
# 4. Removed dependency on separate spf template file.
#
# Tested with El Capitan, Sequel Pro 1.1 (Obac 177), terminus 0.10.0
# original: https://gist.github.com/aaronbauman/f50cc691eb3ed60a358c
@Idealien
Idealien / gflow-complete-step-function.php
Last active March 29, 2018 06:33
Gravity Flow - Different ways to have workflow step(s) trigger post status update
//Update after each step completion - probably executes too often for most use cases
add_action( 'gravityflow_step_complete', 'gravityflow_step_complete_post_publish', 10, 4 );
function gravityflow_step_complete_post_publish( $step_id, $entry_id, $form_id, $status ) {
$entry = GFAPI::get_entry( $entry_id );
$currentPost = get_post( rgar( $entry, 'post_id' ) );
if("draft" == $currentPost->post_status) {
@nciske
nciske / post-content-xml.php
Created April 8, 2015 17:14
Save post content to disk
function pht_write_file( $id, $post) {
$upload_dir = wp_upload_dir();
$file = $upload_dir['basedir']."/publication-hub-tools/test.xml";
$content = $post->post_content;
// convert $content to XML...
file_put_contents( $file, $content );
}
add_action( 'publish_post', 'pht_write_file', 10, 2 );
function mailpoet_enable_wpmail(){
if(class_exists('WYSIJA')){
$model_config = WYSIJA::get('config','model');
$model_config->save(array('allow_wpmail' => true));
}
}
add_action('init', 'mailpoet_enable_wpmail');
@rileypaulsen
rileypaulsen / functions.php
Created August 19, 2014 16:08
Add Advanced Custom Fields Fields to the WP REST API
function wp_api_encode_acf($data,$post,$context){
$data['meta'] = array_merge($data['meta'],get_fields($post['ID']));
return $data;
}
if( function_exists('get_fields') ){
add_filter('json_prepare_post', 'wp_api_encode_acf', 10, 3);
}
@bhwebworks
bhwebworks / Add custom metaboxes to WooCommerce products
Last active May 8, 2023 10:50
Add custom metaboxes to WooCommerce products
/**
* Create Custom Meta Boxes for WooCommerce Product CPT
*
* Using Custom Metaboxes and Fields for WordPress library from
* Andrew Norcross, Jared Atchinson, and Bill Erickson
*
* @link http://blackhillswebworks.com/?p=5453
* @link https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress
*/