Skip to content

Instantly share code, notes, and snippets.

<?php
$args = array(
'post_type' => 'slides',
'posts_per_page' => 999
);
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query($args);
if($wp_query->have_posts()) : ?>
<div id="featured">

This post outlines a way to use Sass, Compass, and Grunt to maintain stylesheets for a WordPress parent and child theme.

Sass is useful for many reasons, but for our purposes, the two most helpful features are partials and variables. We'll also take advantage of the importPath setting of Compass and Grunt.

Comments and improvements are always welcome.

Step 1: Create your parent stylesheet

Create a new Compass project in your theme and style away. When you're finished, your theme directory (called parent here) might look something like this:

@Sanabria
Sanabria / last-word.js
Last active August 29, 2015 14:12 — forked from ramseyp/last-word.js
jQuery(document).ready(function($){
$('h2.title').html(function(){
// separate the text by spaces
var text= $(this).text().split(' ');
// drop the last word and store it in a variable
var last = text.pop();
// join the text back and if it has more than 1 word add the span tag
// to the last word
return text.join(" ") + (text.length > 0 ? ' <span class="last">'+last+'</span>' : last);
@Sanabria
Sanabria / gist:3a1b76c148afbf2830e9
Last active August 29, 2015 14:25 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# First:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
#go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@Sanabria
Sanabria / product-tag-list-for-woocommerce.php
Created October 17, 2015 04:20
Product Tag List Widget for WooCommerce by Webbgaraget.
<?php
/**
* Plugin Name: Product Tag List Widget
* Plugin URI:
* Description: A sidebar Widget for displaying the product tags in a list.
* Version: 1.0
* Author: Webbgaraget
* Author URI: http://www.webbgaraget.se
* Tags: plugin, product, tag, list, widget
* License: GPL
@Sanabria
Sanabria / unbrew.rb
Created February 21, 2016 23:20 — forked from SteveBenner/unbrew.rb
Homebrew uninstall script
#!/usr/bin/env ruby
#
# CLI tool for locating and removing a Homebrew installation
# http://brew.sh/
#
# Copyright (C) 2014 Stephen C. Benner
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@Sanabria
Sanabria / vertical-align.css
Created March 9, 2016 16:04 — forked from marioblas/vertical-align.css
Twitter Bootstrap - Align vertically a column
/* Align vertically a column */
.v-align {
float: none;
display: inline-block;
vertical-align: middle;
}
<a href="#share" class="share">My custom sharing button</a>
<!-- Put the real addthis Share More link somewhere and hide it -->
<a class="addthis_button_compact display_none"></a>
@Sanabria
Sanabria / jquery-scroll-bottom.js
Created August 12, 2016 15:19 — forked from toshimaru/jquery-scroll-bottom.js
Detect the scrolling to bottom of the page using jQuery.
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});
@Sanabria
Sanabria / video.html
Created August 31, 2017 22:12 — forked from fwenzel/video.html
An example video tag, first webm, then ogv, then mp4.
<video id="movie" width="640" height="360" preload="none" controls poster="http://blog.mozilla.com/webdev/files/2011/07/mozilla_wht.png">
<source src="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.webm" type='video/webm; codecs="vp8, vorbis"' />
<source src="http://videos-cdn.mozilla.netserv/flux/playdoh/playdoh-overview.theora.ogv" type='video/ogg; codecs="theora, vorbis"' />
<source src="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.mp4" />
<p>Download video as <a href="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.mp4">MP4</a>, <a href="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.webm">WebM</a>, or <a href="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.theora.ogv">Ogg</a>.</p>
</video>