Skip to content

Instantly share code, notes, and snippets.

View jdsteinbach's full-sized avatar
💭
💻

James Steinbach jdsteinbach

💭
💻
View GitHub Profile
<?php
if ( ! function_exists( 'get_color_cpts' ) ) {
function get_color_things( $color, $cpt ) {
$this_query_args = array(
'post_type' => $cpt,
'numberposts' => -1 // or whatever # you want if you need this limited
'orderby' => 'date',
'order' => 'DESC' // if you need to change order do that here
'tax_query' => array(
array(
@jdsteinbach
jdsteinbach / _mq-debug.sass
Last active January 25, 2016 17:02
WIP Visually Debug Media Queries with Sass
// This depends on Bourbon Neat now. http://neat.bourbon.io/
// You can refactor for your media query mixin / vars.
@mixin mq-debug($color, $min, $max) {
@media screen only and (min-width: $min, max-width: $max) {
&::before {
background-color: rgba($color, .85);
content: "$lap: #{$lap-start} - #{$desk-start - 1}";
}
(function() {
'use strict';
var _img_src_dir = '/src/img/';
var _img_dir = '/img/';
/**
* Minimizes all the images
*/
gulp.task('images', function() {
@jdsteinbach
jdsteinbach / Readme.md
Last active January 29, 2016 17:38
Automatically Generate WP Copyright Range of Dates

Automatically generate the range of years for copyrighted content in WP

This function will find the earliest post or page on your site, compare its year to the current year, and output the correct range of years for your footer copyright statement.

Usage

  • Copy the PHP code into your theme's functions.php
  • In your theme's footer.php use the function <?php copyright_years(); ?> where you want the years to appear

Example

@jdsteinbach
jdsteinbach / SassMeister-input-HTML.html
Last active December 3, 2015 22:49
Generated by SassMeister.com.
<div class="parent">
<div class="neat-style-offset">I'm offset from the left edge using Neat: 2 mixins create 2 selector blocks and 6 properties (one of those properties cancels another out).</div>
</div>
<div class="parent">
<div class="susy-style-offset">I'm offset from the left edge using Susy: 2 functions create 1 selector block with 1 property.</div>
</div>
@jdsteinbach
jdsteinbach / SassMeister-input.scss
Last active September 24, 2015 15:10
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
// Concept & original code by Roy Tomeij (@roy): http://sassmeister.com/gist/e170fbabf144a4fd3911
// Edited by James Steinbach (@jdsteinbach)
// LIBRARY:
$mq-properties: ();
$mq-variables: ();
@jdsteinbach
jdsteinbach / SassMeister-input-HTML.haml
Last active September 15, 2015 19:46
Generated by SassMeister.com.
.div
.div
.div
@jdsteinbach
jdsteinbach / .gitignore
Last active May 20, 2019 13:52
Sass+PostCSS
node_modules
@jdsteinbach
jdsteinbach / ModularPHP.md
Last active September 4, 2015 16:01
Including PHP partials

We're already great with breaking giant template files into multiple smaller files in an /includes/ or /partials/ directory. I'd to talk about how we call those files in our bigger templates. The three options are include, require, and get_template_part(). The first 2 are normal PHP functions, the 3rd is a WP function. (I'm only going to really compare include and get_template_part() though: require is basically include + fatal error, so no real reason to use that by default in our own themes.)

PHP include 'file-path/file-name.php PHP docs

The include function is our default right now. It's got a couple pros over the other options: unlike require, it only generates a warning if the file isn't found, not a fatal error. Unlike get_template_part(), it respects the current file's variables.

WP get_template_part() WP Codex

This is the preferred "WP Way" to ge

@jdsteinbach
jdsteinbach / SassMeister-input.scss
Last active August 28, 2015 21:39
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
@import "susy";
@import "breakpoint";
$susy: (
columns: 1 1,
gutters: 1/32,