Skip to content

Instantly share code, notes, and snippets.

<?php
// call it using this code
get_template_part( 'menu', 'social' );
$(document).ready(function() {
var body_class = $.cookie('body_class');
if(body_class) {
$('body').attr('class', body_class);
}
$("a#switcher").click(function() {
$("body").toggleClass("alternate_body");
$.cookie('body_class', $('body').attr('class'));
});
});
@psflannery
psflannery / delay_add-class
Created September 15, 2013 23:35
Add a class to an element after a specific time
setTimeout(function() {
$('body').addClass("poster");
}, 1000);
@psflannery
psflannery / bg_mouse.js
Created September 28, 2013 11:46
swap images as the mouse moves around the screen...
;(function($){
$.fn.bgMouse = function(argOptions) {
var FILENAME = argOptions.folder;
var FILE_COUNT = argOptions.count;
return this.each(function(index, theContainer) {
@psflannery
psflannery / 100%_div_height.css
Created September 29, 2013 14:37
From http://jsfiddle.net/BDEnM/2/ - equalise the height of divs/make achild div the height of it's parent
#container{
width:400px;
}
#side{
width:100px;
float:left;
background:#aeaeae;
}
#main{
width:300px;
/*
<a href="#" class="arrow">Arrow</a>
*/
.arrow {
display: inline-block;
position: relative;
text-indent: -9999px;
width: 36px;
height: 36px;
background: url(sprites.png) no-repeat;
add_action('init', 'cng_author_base');
function cng_author_base() {
global $wp_rewrite;
$author_slug = 'profile'; // change slug name
$wp_rewrite->author_base = $author_slug;
}
var body = document.getElementsByTagName("body")[0];
var script = document.createElement('script');
script.type = "text/javascript";
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js";
body.appendChild(script);
jQuery(document).ready(function($) {
//capture ipad device change
function doOnOrientationChange()
{
switch(window.orientation)
{
case -90:
case 90:
alert('landscape'); //debug
////add class to assist with libraries like Modernizr
@psflannery
psflannery / jetpack_fallback_image.php
Created October 16, 2013 09:15
From http://wordpress.org/support/topic/help-can-i-specify-a-defaultfallback-image?replies=1 Add a default fallback image to jetpack open graphif no image can be found in a post
function jeherve_custom_image( $media, $post_id, $args ) {
if ( empty( $media ) ) {
$permalink = get_permalink( $post_id );
$url = apply_filters( 'jetpack_photon_url', 'YOUR_LOGO_IMG_URL' );
return array( array(
'type' => 'image',
'from' => 'custom_fallback',
'src' => esc_url( $url ),
'href' => $permalink,