Skip to content

Instantly share code, notes, and snippets.

View cfix.scss
%cfix {
&:before,
&:after {
content:"";
display: table;
}
&:after {
clear:both;
}
& {
@jwebcat
jwebcat / add-back-as-post.php
Created Jan 31, 2014
remove cpt tax from url
View add-back-as-post.php
/**
* 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 Feb 2, 2014
previous next post links with thumbnails wp --> goes inside post loop
View posts-nav-thumbs-wp.php
<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
View gist:10438752
<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 Apr 14, 2014
lightbox examples
View lightbox.html
<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">
View caption-in-swipebox.html
<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">
View scroll-to.jquery.js
// 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;
});
});
View access.php
/**
* 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 Oct 23, 2014
this is to run duo with gulp
View duo-gulpfile.js
/**
* Module Dependencies
*/
var map = require('map-stream');
var Duo = require('../../');
var gulp = require('gulp');
/**
* Default
@jwebcat
jwebcat / duo-2-gulpfile.js
Created Oct 23, 2014
another version of gulp with duo
View duo-2-gulpfile.js
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']
},