Skip to content

Instantly share code, notes, and snippets.

View rachelbaker's full-sized avatar

Rachel Baker rachelbaker

View GitHub Profile
@rachelbaker
rachelbaker / wp_multi_tax_query.php
Created November 12, 2012 18:40
WordPress list posts that are in two different taxonomies
<?php
// NOTE: replace the values of these variables with custom taxonomies
$multi_term1 = 'taxonomy_term1';
$multi_term2 = 'taxonomy_term2';
// get all terms for taxonomy1
$multi1_terms = get_terms($multi_term1);
foreach ( $multi1_terms as $multi1_term ) {
$multi1_term1slugs[]= $multi1_term->slug;
}
@rachelbaker
rachelbaker / wp_get_customer_review_cpt_template.php
Created November 12, 2012 15:47
WordPress display plugin template file for custom post type
<?php
add_filter('template_include', array($this, 'get_customer_review_cpt_template'), 100);
public function get_customer_review_cpt_template($template)
{
global $template;
// Our custom post type.
$post_type = 'customer_reviews';
@rachelbaker
rachelbaker / EE-edit-this.html
Created October 12, 2012 17:45
ExpressionEngine snippet for edit this link
{if author_id == logged_in_member_id OR logged_in_member_group == "1"}<a href="{site_url}/admin.php?S=0&D=cp&C=content_publish&M=entry_form&channel_id={channel_id}&entry_id={entry_id}">Edit This</a>{/if}
@rachelbaker
rachelbaker / wp_tax_breadcrumbs.php
Created October 3, 2012 02:47
wordpress taxonomy breadcrumb with taxonomy hierarchy
} else if ( is_tax() ) {
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
// Create a list of all the term's parents
$parent = $term->parent;
while ( $parent ):
$parents[] = $parent;
$new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
$parent = $new_parent->parent;
endwhile;
@rachelbaker
rachelbaker / recent-tweet.js
Created September 22, 2012 18:29
Fetch most recent tweet for declared username
/**
* Fetch Most Recent Tweet
* @author: Rachel Baker
*
* Fetches most recent tweet for a declared username and displays returned data
*
*
*/
jQuery(document).ready(function($) {
// Declare twitter username here
@rachelbaker
rachelbaker / soulver-typography-calc
Created September 21, 2012 21:27
typography rhythm calculator formula for Soulver app
#Typography Rhythm
rem = 16
######
basefont = 14
baseems = ( basefont / rem )
######
baseline = 20
doublebaseline = ( baseline × 2 )
@rachelbaker
rachelbaker / media.less
Created September 21, 2012 20:26
LESS Media Defaults
/* Media Styles
-------------------------------------------------------------- */
// Images
// -------------------------
// Rounded corners
.img-rounded {
.rounded(6px);
}
@rachelbaker
rachelbaker / updated-mixins.less
Created September 21, 2012 20:20
updated LESS mixins
//
// Mixins
// --------------------------------------------------
// TYPOGRAPHY Rhythm
// --------------------------------------------------
// TODO: Cite reference links
// Set a font-size based on the @size provided in rem values with a pixel fallback.
// Then set a line-height based on the body line-height, calculated as @baseLineHeight * @multiple (@multiple defaults to 1)
// font-size: 18px ( @size * 1px )
@rachelbaker
rachelbaker / launch_sublime_from_terminal.markdown
Created September 11, 2012 19:43 — forked from artero/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@rachelbaker
rachelbaker / enqueue-flexslider.php
Created September 5, 2012 22:49
enqueue Flexslider script
function YU_scripts() {
wp_enqueue_script( 'jquery');
wp_enqueue_script( 'jquery-ui-tabs', array('jquery') );
wp_enqueue_script( 'flexslider', get_template_directory_uri() . '/js/jquery.flexslider.js', array('jquery') );
wp_enqueue_script( 'flexslider-init', get_template_directory_uri() . '/js/jquery.flexslider-init.js', array('jquery', 'flexslider') );