Skip to content

Instantly share code, notes, and snippets.

@jwebcat
jwebcat / cfix.scss
Created January 31, 2014 06:28
cfix extend
%cfix {
&:before,
&:after {
content:"";
display: table;
}
&:after {
clear:both;
}
& {
@jwebcat
jwebcat / add-back-as-post.php
Created January 31, 2014 10:57
remove cpt tax from url
/**
* Some hackery to have WordPress match postname to any of our public post types
* All of our public post types can have /post-name/ as the slug, so they better be unique across all posts
* Typically core only accounts for posts and pages where the slug is /post-name/
*/
function vipx_parse_request_tricksy( $query ) {
// Only noop the main query
if ( ! $query->is_main_query() )
return;
@jwebcat
jwebcat / posts-nav-thumbs-wp.php
Created February 2, 2014 11:11
previous next post links with thumbnails wp --> goes inside post loop
<div id="cooler-nav" class="navigation">
<?php
$prevPost = get_previous_post(true);
if($prevPost) : ?>
<div class="nav-box previous">
<?php $prevthumbnail = get_the_post_thumbnail($prevPost->ID, array(100,100) ); ?>
<?php previous_post_link('%link',"$prevthumbnail <p>%title</p>", TRUE); ?>
</div>
<?php endif; ?>
<?php
<div class="c-gallery">
<a rel="gallery-1" class="swipebox" href="http://local.wordpress-trunk.dev/wp-content/uploads/2014/01/air_conditioner.png">
<img src="http://local.wordpress-trunk.dev/wp-content/uploads/2014/01/air_conditioner.png" alt="image">
</a>
<a rel="gallery-1" class="swipebox" href="http://local.wordpress-trunk.dev/wp-content/uploads/2014/01/air_conditioner.png">
<img src="http://local.wordpress-trunk.dev/wp-content/uploads/2014/01/air_conditioner.png" alt="image">
</a>
<a rel="gallery-1" class="swipebox" href="http://local.wordpress-trunk.dev/wp-content/uploads/2014/01/air_conditioner.png">
<img src="http://local.wordpress-trunk.dev/wp-content/uploads/2014/01/air_conditioner.png" alt="image">
</a>
@jwebcat
jwebcat / lightbox.html
Created April 14, 2014 23:05
lightbox examples
<div class="c-gallery">
<a rel="gallery-1" class="swipebox" href="/wp-content/uploads/2014/01/air_conditioner.png">
<img src="/wp-content/uploads/2014/01/air_conditioner.png" alt="image">
<p>I'm an image link that opens a image lightbox gallery</p>
</a>
<a rel="gallery-1" class="swipebox" href="/wp-content/uploads/2014/01/air_conditioner.png">
<img src="/wp-content/uploads/2014/01/air_conditioner.png" alt="image">
</a>
<a rel="gallery-1" class="swipebox" href="/wp-content/uploads/2014/01/air_conditioner.png">
<img src="/wp-content/uploads/2014/01/air_conditioner.png" alt="image">
@jwebcat
jwebcat / caption-in-swipebox.html
Created April 16, 2014 23:03
swipebox caption demo
<div class="c-gallery">
<a rel="gallery-1" class="swipebox" href="/wp-content/uploads/2014/01/air_conditioner.png" title="I'm a caption in the title attribute of the a tag">
<img src="/wp-content/uploads/2014/01/air_conditioner.png" alt="image">
<p>I'm an image link that opens a image lightbox gallery</p>
</a>
<a rel="gallery-1" class="swipebox" href="/wp-content/uploads/2014/01/air_conditioner.png" title="I'm another caption in the title attribute of the a tag">
<img src="/wp-content/uploads/2014/01/air_conditioner.png" alt="image">
</a>
<a rel="gallery-1" class="swipebox" href="/wp-content/uploads/2014/01/air_conditioner.png" title="I'm yet another caption in the title attribute of the a tag">
<img src="/wp-content/uploads/2014/01/air_conditioner.png" alt="image">
// scroll to div
$(function($){
$('a.nav').click(function() {
var $this = $(this),
_href = $this.attr('href'),
dest = $(_href).offset().top;
$("html:not(:animated),body:not(:animated)").animate({ scrollTop: dest}, 400 );
return false;
});
});
/**
* Checks if a particular user has a role.
* Returns true if a match was found.
*
* @param string $role Role name.
* @param int $user_id (Optional) The ID of a user. Defaults to the current user.
* @return bool
*/
function appthemes_check_user_role( $role, $user_id = null ) {
@jwebcat
jwebcat / duo-gulpfile.js
Created October 23, 2014 01:11
this is to run duo with gulp
/**
* Module Dependencies
*/
var map = require('map-stream');
var Duo = require('../../');
var gulp = require('gulp');
/**
* Default
@jwebcat
jwebcat / duo-2-gulpfile.js
Created October 23, 2014 01:13
another version of gulp with duo
var duo = require('duo'); // https://github.com/duojs/duo
var map = require('map-stream'); // https://github.com/dominictarr/map-stream
var paths = {
build: {
src: {
jsApp: ['./src/js/main.js'],
jsClient: ['./src/js/client.js']
},