Skip to content

Instantly share code, notes, and snippets.

View shawnhooper's full-sized avatar

Shawn Hooper shawnhooper

View GitHub Profile
@shawnhooper
shawnhooper / modify_rest_caps.php
Created December 2, 2015 04:46
Allow WordPress REST API to read a single post, by post status
add_filter( 'user_has_cap', array( __CLASS__, 'allow_rest_to_read_single_archived_module' ), 10, 3 );
/***
* Modify the capabilities of the REST API to view a single
* "module" post if requested with its post ID.
*
* @param $allcaps
* @param $cap
* @param $args
*
<?php
/**
Plugin Name: CLI Export Multisite
*/
if ( ! defined( 'WP_CLI' ) ) return;
use \WP_CLI\Utils;
/**
<?php
/**
Plugin Name: CLI Export Multisite
*/
if ( ! defined( 'WP_CLI' ) ) return;
use \WP_CLI\Utils;
/**
add_rewrite_rule('^workshops/([^/]+)(/[0-9]+)?/([^/]+)/([^/]+)', 'index.php?&workshop=$matches[4]&page=', 'top');
add_rewrite_rule('^workshops/([^/]+)(/[0-9]+)?/([^/]+)', 'index.php?pagename=workshops&cat=$matches[1]&subcat=$matches[3]', 'top');
add_rewrite_rule('^workshops/([^/]+)/?', 'index.php?pagename=workshops&cat=$matches[1]', 'top');
add_rewrite_tag('%subcat%', '([^&]+)');
@shawnhooper
shawnhooper / gist:9967205
Created April 4, 2014 02:55
Response to WordPress Stack Exchange : 140202
<?php
/*idea to develop further would be, add a text box that the user can input the quote in
this then gets added to the DB and passed to the $quotes array. From here the results get
output the same way*/
/*
Plugin Name: Random Quotes
Plugin URI: xxx
Description: This Plugin randomly generates Quotes input by the user.
Version: 0.0.1