Skip to content

Instantly share code, notes, and snippets.

View kalenjohnson's full-sized avatar

Kalen Johnson kalenjohnson

View GitHub Profile
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'),
<?php
echo paginate_links( array(
'format' => 'page/%#%',
'show_all' => true,
'prev_text' => __('<'),
'next_text' => __('>'),
));
@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")
};
@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.
*/
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 / _header.less
Last active August 29, 2015 14:06
no padding at col-md
.banner {
.search-container {
@media (min-width: @screen-md-min) and (max-width: @screen-md-max) {
padding: 0;
}
}
}
@kalenjohnson
kalenjohnson / functions.php
Created August 28, 2014 05:23
Wordpress - Fix custom post type archive and active menu classes
<?php
// Taken from http://wordpress.org/support/topic/why-does-blog-become-current_page_parent-with-custom-post-type
function remove_parent_classes($class) {
// check for current page classes, return false if they exist.
return ($class == 'active') ? FALSE : TRUE;
}
add_filter('nav_menu_css_class', function ($classes) {
switch (get_post_type())
@kalenjohnson
kalenjohnson / gist:3ea4ca428cf504f62261
Created August 23, 2014 00:14
WP_Query specific taxonomy and sticky post
$competitor->featured = new WP_Query([
'post_type' => 'train',
'train-categories' => 'workouts',
'posts_per_page' => 2,
'post__in' => get_option( 'sticky_posts' ),
]);
@kalenjohnson
kalenjohnson / gist:ec15d227583ce3f4fcd2
Created August 15, 2014 18:17
Show loader on page
(function($) {
jQuery(window).load(function($){
// Turn off the page loader
jQuery('#ajax-loader').fadeOut(500);
});
})(jQuery);
<div id="primary" class="content-area site-archives col-xs-12">
<?php if( function_exists('bcn_display') ) {
bcn_display();
} ?>
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post();
get_template_part( 'content', 'page' );