Skip to content

Instantly share code, notes, and snippets.

View MikeGillihan's full-sized avatar
🏠
Working from home

Mike Gillihan MikeGillihan

🏠
Working from home
View GitHub Profile
@MikeGillihan
MikeGillihan / Preferences.sublime-settings
Created January 28, 2013 18:16
My Sublime Text 2 user preferences
{
"theme": "Soda Dark.sublime-theme",
"font_size": 14.0,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"word_wrap": true,
"caret_style": "phase",
"highlight_line": true,
"line_padding_bottom": 1,
"line_padding_top": 1,
@MikeGillihan
MikeGillihan / Custom Wordpress Excerpts
Last active December 15, 2015 05:39
Custom excerpt lengths for Wordpress. USAGE: <?php echo ows_excerpt(55); ?>
function ows_excerpt($num) {
$cont = get_the_content();
$more = '&hellip; <a href="' . get_permalink() . '">Read More</a>';
$excerpt = wp_trim_words( $cont, $num, $more );
return $excerpt;
}
@MikeGillihan
MikeGillihan / Font sizing with rem mixin
Last active January 3, 2016 09:19
Font sizing with rem mixin. A simple Sass mixin for sizing fonts with rem plus px as a fallback.
@mixin fontsize($size: 16, $base: 16) {
font-size: $size + px;
font-size: ($size / $base) * 1rem;
}
@MikeGillihan
MikeGillihan / sass-color-wheel
Created February 11, 2014 20:07
Color Wheel Mixin
// COLOR WHEEL
@mixin colorwheel($color: $colorBrand,$colors: 6,$spectrum: 180deg,$offset: 30deg) {
@for $i from 0 to $colors {
&:nth-child(#{$i}) {
background: adjust-hue($color, $offset + $spectrum / $colors * $i);
}
}
}
@MikeGillihan
MikeGillihan / wp-styleguide
Created August 8, 2014 05:49
WordPress Style Guide Post Content
<section id="intro">
<p class="intro">This is the style guide for your website. This document sets the styles and standards to be used when updating or contributing to your site. In this guide you will find examples of what your site is supposed to look like and the many HTML elements that you can use in your posts and pages.</p>
<p class="intro">Not only can you view how the elements will appear on your site, but you can also see how these elements are implemented by viewing the <q>Your Website Style Guide</q> post within the WordPress post editor.</p>
</section><!-- END #intro -->
<section id="branding">
<h2 class="font-script callout">Branding</h2>
<h3>Colors &amp; Textures</h3>
<ul class="colors">
<li class="color-light"><var>#F5F5F5</var></li>
@MikeGillihan
MikeGillihan / color-scheme
Created August 9, 2014 00:07
Add ACF field Color Scheme Class
/**
* Color Scheme
* Add color theme class to <body>
* Requires custom field 'color_scheme'
*/
// add_filter('body_class', 'genesass_color_scheme');
function genesass_color_scheme($classes) {
$color_scheme = get_field('color_scheme');
@MikeGillihan
MikeGillihan / trackback-killer
Created August 11, 2014 19:40
SQL query to set track/pingbacks on all posts to closed.
UPDATE wp_posts SET ping_status="closed";
// Show ACF menu for user_ID 1 only
function remove_acf_menu() {
$current_user = wp_get_current_user();
if ( $current_user->ID != 1 ) {
remove_menu_page( 'edit.php?post_type=acf' );
}
}
add_action( 'admin_menu', 'remove_acf_menu', 100 );
@MikeGillihan
MikeGillihan / WP_native_classes
Created December 6, 2014 03:10
WordPress Native Classes
// Body Classes
// ----------------------------------------
.home {} // if it's the homepage
.page {} // if it's any page
.postid-XX {} // if it's a post - XX is the post's ID
.rtl {} // when dealing with right-to-left content
.blog {} // if it's the custom blog listing
.archive {} // if it's any sort of archive page
.category {} // if it's a categories listing page
.tag {} // if it's a tags listing page
@MikeGillihan
MikeGillihan / sassy-grid.scss
Created January 20, 2015 20:02
Just Another Sassy Grid
// Just Another Sassy Grid
// ---------------------------------------------
$pad: 2rem;
$base-container-width: 100rem;
$gridpad: ( $pad / $base-container-width ) * 100%;
.row {
// margin-bottom: $gridpad; // Optional row padding