Skip to content

Instantly share code, notes, and snippets.

View wunderdojo's full-sized avatar

Jamie Currie wunderdojo

View GitHub Profile
@wunderdojo
wunderdojo / sample-api.php
Created June 9, 2018 05:09
Sample API Endpoint
register_rest_route( MSAPIPATH, '/accounts',
[
'methods' => \WP_REST_Server::READABLE,
'callback' => [
'MS\Controllers\Accounts_API_Controller', 'api_route_get_accounts'
],
'permission_callback' => function () {
@wunderdojo
wunderdojo / post.sh
Last active January 23, 2018 20:25
WP installer for Vagrant Box
#!/usr/bin/env bash
# Post provisioning script
#check if WP is installed and if not download it
if [ ! -d "$1/wp-admin" ]; then
cd $1
wget http://wordpress.org/latest.tar.gz
tar xfz latest.tar.gz
mv wordpress/* ./
rmdir ./wordpress/
rm -f latest.tar.gz
@wunderdojo
wunderdojo / acf-filter-by-taxonomy-slug.php
Created March 31, 2016 17:50
ACF 5 Custom Location Rule using Taxonomy Name and Slug
<?php
//-http://www.advancedcustomfields.com/resources/custom-location-rules/
//- Create new rule type in the Location rules section
add_filter( 'acf/location/rule_types', 'acf_location_rules_types' );
function acf_location_rules_types( $choices ){
$choices['Post']['taxonomy_slug'] = 'Fee Type';
return $choices;
}
@wunderdojo
wunderdojo / Integral MailChimp Email Archives
Created March 26, 2015 03:12
Display an archive of MailChimp emails on your WordPress site
<?php
/*
* Template Name: Email Archives
* See the codex entry on custom template for more information: http://codex.wordpress.org/Page_Templates#Custom_Page_Template
*/
get_header();
<div class='container'>
<?php
/*
Insert this script into functions.php in your WordPress theme (be cognizant of the opening and closing php tags) to allow field groups in Gravity Forms. The script will create two new field types - Open Group and Close Group. Add classes to your Open Group fields to style your groups.
Note that there is a stray (but empty) <li> element created. It is given the class "fieldgroup_extra_li" so that you can hide it in your CSS if needed.
*/
add_filter("gform_add_field_buttons", "add_fieldgroup_fields");
function add_fieldgroup_fields($field_groups){
foreach($field_groups as &$group){