Skip to content

Instantly share code, notes, and snippets.

View nathansh's full-sized avatar
🏠

Nathan Shubert-Harbison nathansh

🏠
View GitHub Profile
<snippet>
<content><![CDATA[
global \$wp_query;
\$query = array(
$1
);
\$args = array_merge(\$wp_query->query_vars, \$query);
\$posts = query_posts(\$args);
]]></content>
@nathansh
nathansh / docblock1.php
Last active August 29, 2015 14:18
Basic docblock example with associative array
/**
* Used to print a list of shows in feed format
*
* <code>
* $args = array(
* 'count' => 6, // int
* 'exclude_featured' => false,
* 'exclude_past' => true, // bool
* 'exclude_future' => false, // bool
* 'genre' => false, // show genres to include
@nathansh
nathansh / dockblock2.php
Created March 31, 2015 20:40
Simple docblock that doesn't return anything
/**
* Prints classes for a custom menu. Prints added class and any passed in class
*
* @param string $item Slug for menu item
* @param string $classes Extra classes to print
* @uses mbt_show_listing_menu_is_current()
*
*/
@nathansh
nathansh / docblock3.php
Created March 31, 2015 20:41
Another docblock
/**
* Generates markup for the show highlight tile, used on the homepage and
* show single pages.
*
* @uses mbt_show_single_date
* @uses mbt_get_acf_image
* @uses mbt_get_show_badges
* @uses mbt_get_show_venue_link
* @uses mbt_get_show_dates
* @uses mbt_get_show_presenter
@nathansh
nathansh / apigen_command
Created March 31, 2015 20:42
apigen with multiple sources and options we should use
apigen generate -s wp-content/themes/mount-baker-theatre/includes -s wp-content/plugins/mount-baker-theatre/includes/ -d docs --todo --deprecated --internal --template-theme=bootstrap --title='Mount Baker Theatre'
@nathansh
nathansh / default.settings.php
Created June 10, 2015 20:12
Drupal 6 settings.php (sites/default/default.settings.php)
<?php
/**
* @file
* Drupal site-specific configuration file.
*
* IMPORTANT NOTE:
* This file may have been set to read-only by the Drupal installation
* program. If you make changes to this file, be sure to protect it again
* after making your modifications. Failure to remove write permissions
@nathansh
nathansh / nathansh-ascii-banner.html
Created June 21, 2015 07:34
nathansh.com ascii name banner
<!--
_ _ _
| | | | | |
_ __ __ _| |_| |__ __ _ _ __ ___| |__ ___ ___ _ __ ___
| '_ \ / _` | __| '_ \ / _` | '_ \/ __| '_ \ / __/ _ \| '_ ` _ \
| | | | (_| | |_| | | | (_| | | | \__ \ | | || (_| (_) | | | | | |
|_| |_|\__,_|\__|_| |_|\__,_|_| |_|___/_| |_(_)___\___/|_| |_| |_|
@nathansh
nathansh / acf_api.php
Created August 2, 2015 22:44
Add ACF fields to WP JSON API V2
<?php
function d7_add_acf_to_json_api_v2($object, $field_name, $request){
if ( function_exists('get_fields') ) {
return get_fields($object['id']);
}
}
if ( is_plugin_active('rest-api/plugin.php') ) {
add_filter('rest_api_init', function(){
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ofv",
"*.ttf",
"*.tga",