Skip to content

Instantly share code, notes, and snippets.

View asimpson's full-sized avatar

Adam Simpson asimpson

View GitHub Profile
@asimpson
asimpson / get_pods_data.php
Created August 7, 2012 14:37
Pull Pods CMS data into Wordpress template. Mainly made this gist to pull into ST2 via fetch
<?php
$field = pods('pod_name') -> find();
if ( 0 < $field->total() ) {
while ( $field->fetch() ) {
$data = $field -> field('field_name');
echo '<div class="div">';
echo $data;
echo '</div>';
}
}
@asimpson
asimpson / register-enqueue-script.php
Created August 7, 2012 21:12
The proper way to include a script/stylesheet in Wordpress functions.php - wrote this to call from ST2 via fetch
<?php
function adam_load_scripts(){
wp_register_script( 'handle', get_template_directory_uri()."path", array('dep'), 'ver', 'footer?');
//to add a stylesheet, change all script to style except wp_enqueue_script
//wp_register_style( 'handle', get_template_directory_uri()."path", array('dep'), 'ver', 'media')
wp_enqueue_script('handle');
}
add_action('wp_enqueue_scripts', 'adam_load_scripts');
@asimpson
asimpson / wp_query.php
Created August 7, 2012 21:35
WP_Query syntax to easily pull down for use in ST2
<?php
$query = new WP_Query( 'params' );//http://codex.wordpress.org/Function_Reference/WP_Query
while($query->have_posts()) : $query->the_post();
//content goes here
endwhile;
wp_reset_postdata(); // reset the query
@asimpson
asimpson / wp_cpt.php
Created August 14, 2012 13:59
Easy way to pull down a Custom Post Type Boilerplate
<?php
function function_cpt() {
$post_type_args = array(
'label' => "Label",
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'query_var' => true,
@asimpson
asimpson / My Sublime Preferences
Created August 30, 2012 17:15
This is a simple copy and paste of my Sublime Text 2 preference file. Use whatever you want!
// Settings in here override those in "Default/Preferences.sublime-settings", and
// are overridden in turn by file type specific settings.
{
"bold_folder_labels": true,
"close_windows_when_empty": true,
"color_scheme": "Packages/Theme - Aqua/Color Schemes/Tomorrow Night Aqua.tmTheme",
"detect_slow_plugins": false,
"draw_centered": false,
"fade_fold_buttons": false,
"font_face": "Menlo",
@asimpson
asimpson / validpopover.js
Created September 11, 2012 20:50
Validation + Popover
if( !Modernizr.formvalidation ){
var sb_formValidation = $('.content form, .search-container form, .support-search form');
H5F.setup(sb_formValidation);
$(sb_formValidation).find('[required]').popover({
placement:'bottom',
title:'Required!',
content:"Please fill out this field.",
@asimpson
asimpson / eventListener.js
Created September 12, 2012 14:11
eventListener IE8 and below
/* window.addEventListener( "resize", mmListener);
mmListener();*/
if (window.addEventListener) {
window.addEventListener("resize", mmListener);
} else if (window.attachEvent) {
window.attachEvent("resize", mmListener);
}
mmListener();
@asimpson
asimpson / _mixins.scss
Created September 17, 2012 21:14 — forked from robtarr/_mixins.scss
SASS Mixin with keyword font-size fallback
@mixin font-size( $decimal-size, $keyword: null ) {
@if $keyword{ font-size: $keyword; }
@else { font-size: $decimal-size * $base-font-multiplier * 16px;}
font-size: $decimal-size * 1rem;
}
@asimpson
asimpson / gist:3813853
Last active October 11, 2015 05:58
Exclude sublime workspace and project files from sublime sidebar
{
"folders":
[
{
"file_exclude_patterns":
[
"*.sublime-*"
],
"folder_exclude_patterns":
[
@asimpson
asimpson / tomorrow-theme.css
Created October 5, 2012 17:48
Web Inspector Tomorrow Theme
/**********************************************/
/*
/* Tomorrow Skin by Ben Truyman - 2011
/*
/* Based on Chris Kempson's Tomorrow Theme:
/* https://github.com/ChrisKempson/Tomorrow-Theme
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*