Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠

Nathan Shubert-Harbison nathansh

🏠
View GitHub Profile
View query_posts.sublime-snippet
<snippet>
<content><![CDATA[
global \$wp_query;
\$query = array(
$1
);
\$args = array_merge(\$wp_query->query_vars, \$query);
\$posts = query_posts(\$args);
]]></content>
View d7_edit_link.php
@nathansh
nathansh / dockblock2.php
Created Mar 31, 2015
Simple docblock that doesn't return anything
View dockblock2.php
/**
* 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()
*
*/
View docblock3.php
/**
* 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 Mar 31, 2015
apigen with multiple sources and options we should use
View apigen_command
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 / docblock1.php
Last active Aug 29, 2015
Basic docblock example with associative array
View docblock1.php
/**
* 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 / default.settings.php
Created Jun 10, 2015
Drupal 6 settings.php (sites/default/default.settings.php)
View 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 Jun 21, 2015
nathansh.com ascii name banner
View nathansh-ascii-banner.html
<!--
_ _ _
| | | | | |
_ __ __ _| |_| |__ __ _ _ __ ___| |__ ___ ___ _ __ ___
| '_ \ / _` | __| '_ \ / _` | '_ \/ __| '_ \ / __/ _ \| '_ ` _ \
| | | | (_| | |_| | | | (_| | | | \__ \ | | || (_| (_) | | | | | |
|_| |_|\__,_|\__|_| |_|\__,_|_| |_|___/_| |_(_)___\___/|_| |_| |_|
@nathansh
nathansh / acf_api.php
Created Aug 2, 2015
Add ACF fields to WP JSON API V2
View acf_api.php
<?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(){
View Preferences.sublime-settings
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ofv",
"*.ttf",
"*.tga",