Skip to content

Instantly share code, notes, and snippets.

View onishiweb's full-sized avatar

Adam Onishi onishiweb

View GitHub Profile
/**
* Include useful classes in body_class and post_class
*/
function dig_add_useful_classes($classes) {
global $post;
if( ! is_tag() ) {
$classes[] = dig_get_post_type_class();
}
/**
* Post type class function
* @author Adam Onishi <aonishi@wearearchitect.com>
*/
function dig_get_post_type_class( $type = false ) {
if( ! $type ) {
$type = dig_current_post_type();
}
$class = str_replace('dig_', '', $type);
/**
* Work out the current post type
* - based on WP function or current taxonomy
* @author Adam Onishi (aonishi@wearearchitect.com)
*/
function dig_current_post_type() {
global $post;
if( ! is_tag() ) {
$type_name = get_post_type();
<?php
// In a file somewhere that you include (functions etc)
function switch_wrapper( $clause )
{
switch ($clause)
{
case 'foo':
echo "Foo was here!";
break;
@onishiweb
onishiweb / SassMeister-input.scss
Created August 27, 2014 09:49
Generated by SassMeister.com.
// ----
// Sass (v3.4.1)
// Compass (v1.0.1)
// ----
.selector {
width:100px;
height:100px;
.child-selector {
/**
* Read the contents of the theme CSS file into a variable and ouput.
**/
function ajo_inline_styles() {
$css_file = get_stylesheet_uri(); // This will load the entire theme stylesheet in the head (only recommended if it's small)
// to include specific CSS use: `get_template_directory_uri() . '/path-to-above-the-fold.css'
$css = file_get_contents($css_file);
echo "<style>{$css}</style>";
@onishiweb
onishiweb / SassMeister-input.scss
Created October 4, 2014 20:52
Generated by SassMeister.com.
// ----
// Sass (v3.4.4)
// Compass (v1.0.1)
// ----
// Set fix-mqs to the em width media queries should output at
$fix-mqs:false;
// Set map of breakpoints
$breakpoints: (
@onishiweb
onishiweb / index.html
Created October 23, 2014 08:40
A Pen by Adam Onishi.
<div class="video-wrapper">
<iframe src="//www.youtube.com/embed/bVKCHZqax84" frameborder="0" allowfullscreen></iframe>
</div>
@onishiweb
onishiweb / SassMeister-input.scss
Created March 9, 2015 12:11
Generated by SassMeister.com.
// ----
// libsass (v3.1.0)
// ----
$base-font-size:16px;
@mixin rem($property, $px-values, $baseline-px: $base-font-size) {
// Convert the baseline into rems
$baseline-rem: $baseline-px / 1rem;