A Pen by Captain Anonymous on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rems with pixel fallback for any property | |
// @author @BPScott (https://github.com/BPScott/bpscott.github.io/blob/develop/source/stylesheets/vendor/_rem.scss) | |
@mixin rem($property, $px-values, $baseline-px: $base-font-size) { | |
// Convert the baseline into rems | |
$baseline-rem: $baseline-px / 1rem; | |
// Create an empty list that we can dump values into | |
$rem-values: (); | |
@each $value in $px-values { | |
// If the value is zero, return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Post type class function | |
* @author Adam Onishi <[email protected]> | |
*/ | |
function dig_get_post_type_class( $type = false ) { | |
if( ! $type ) { | |
$type = dig_current_post_type(); | |
} | |
$class = str_replace('dig_', '', $type); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Work out the current post type | |
* - based on WP function or current taxonomy | |
* @author Adam Onishi ([email protected]) | |
*/ | |
function dig_current_post_type() { | |
global $post; | |
if( ! is_tag() ) { | |
$type_name = get_post_type(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// In a file somewhere that you include (functions etc) | |
function switch_wrapper( $clause ) | |
{ | |
switch ($clause) | |
{ | |
case 'foo': | |
echo "Foo was here!"; | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.1) | |
// Compass (v1.0.1) | |
// ---- | |
.selector { | |
width:100px; | |
height:100px; | |
.child-selector { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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>"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// 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: ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="video-wrapper"> | |
<iframe src="//www.youtube.com/embed/bVKCHZqax84" frameborder="0" allowfullscreen></iframe> | |
</div> |