Skip to content

Instantly share code, notes, and snippets.

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;
}
/*
<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;
@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;
@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 / 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);
$(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'));
});
});
<?php
// call it using this code
get_template_part( 'menu', 'social' );
@psflannery
psflannery / video.php
Created August 21, 2013 12:59
A template for displaying video attachments. Add the video code inside the loop where we’d like to display the content within.
<video class="my-video-class">
<source src="<?php echo wp_get_attachment_url( $post->ID ) ?>" type='video/mp4' />
Your browser does not support the video tag.
</video>
var replaced = $("body").html().replace(/-1o9-2202/g,'The ALL new string');
$("body").html(replaced);
//or, as a one liner
$("body").html($("body").html().replace(/12345-6789/g,'<b>abcde-fghi</b>'));
//replace every word
$("body").html($("p").html().replace(/[a-zA-Z0-9_]\w/g,'<b>oh hai!!!</b>'));
@psflannery
psflannery / tax_visual_editor
Created July 17, 2013 15:43
Adds a visual editor to the description field for custom taxonomies. Example below will display the tinymce editor in every custom taxonomy description right now. Can edit to show it for only some specific taxonomy. See also - http://wordpress.org/plugins/rich-text-tags/
/**
* Display advanced TinyMCE editor in taxonomy page
*/
function wpse_7156_enqueue_category() {
global $pagenow, $current_screen;
if( $pagenow == 'edit-tags.php' ) {
require_once(ABSPATH . 'wp-admin/includes/post.php');
require_once(ABSPATH . 'wp-admin/includes/template.php');