Skip to content

Instantly share code, notes, and snippets.

View kalenjohnson's full-sized avatar

Kalen Johnson kalenjohnson

View GitHub Profile
add_action('pre_get_posts', function( $query ) {
if ( ! is_admin() && is_archive('employee') && $query->is_main_query() ) {
$query->set( 'orderby', 'title' );
$query->set( 'order', 'ASC' );
}
return $query;
});
@kalenjohnson
kalenjohnson / _csswizardry.less
Created October 3, 2014 22:06
bastardized for me :D
/*------------------------------------*\
@CSSWIZARDRY-GRIDS
\*------------------------------------*/
/**
* CONTENTS
* VARIABLES............Your settings.
* GRID SETUP...........Build the grid structure.
* WIDTHS...............Build our responsive widths around our breakpoints.
*/
@kalenjohnson
kalenjohnson / controllers.js
Created October 3, 2014 23:09
product controller
function ProductCatController($scope, $http) {
$scope.childCategoriesTemplate = wp_api.theme + "/templates/angular/child-categories.html";
$http.get(wp_api.url + '/taxonomies/product_cat/terms').
success(function(data) {
var container = document.getElementById("product-category-container");
$scope.container = {
taxonomyParent: container.getAttribute("data-taxonomy-parent")
};
<?php
echo paginate_links( array(
'format' => 'page/%#%',
'show_all' => true,
'prev_text' => __('<'),
'next_text' => __('>'),
));
var gulp = require('gulp'),
less = require('gulp-less'),
autoprefix = require('gulp-autoprefixer'),
sourcemaps = require('gulp-sourcemaps'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
minifyCSS = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
livereload = require('gulp-livereload'),
wp_enqueue_script('duchateau_js', get_template_directory_uri() . $assets['js'], array(), null, true);
wp_localize_script( 'duchateau_js', 'wp_api', array(
'url' => esc_url_raw(get_json_url()),
'theme' => esc_url_raw(get_template_directory_uri())
) );
add_action('plugins_loaded', 'remove_jetpack_widget_conditions',11);
function remove_jetpack_widget_conditions(){
remove_action( 'init', array('Jetpack_Widget_Conditions','init') );
}
class InstagramFeed {
protected $keys;
public function __construct($user_id, $access_code)
{
$this->keys = [
'user_id' => $user_id,
'access_code' => $access_code,
];
class autoloader {
public static $loader;
public static function init()
{
if (self::$loader == NULL)
self::$loader = new self();
return self::$loader;
@kalenjohnson
kalenjohnson / titles.php
Created February 3, 2015 20:16
Sage Title with namespace
<?php
namespace Roots\Sage\Titles;
/**
* Page titles
*/
function title() {
if (is_home()) {
if (get_option('page_for_posts', true)) {