Skip to content

Instantly share code, notes, and snippets.

View mattwiebe's full-sized avatar

Matt Wiebe mattwiebe

View GitHub Profile
<?php
/**
* A couple of functions for caching the global post object so that contextual
* stuff (eg: sidebars) still works after custom queries
* NOT for use with query_posts(). Real WP coders always do a new WP_Query.
*/
function sd_cache_post() {
global $post, $sd_cached_post;
$sd_cached_post = $post;
}
/**
* Lucida Grande doesn't have italics, but is preferable for its small size awesomeness.
* Lucida Sans has lovely italics.
* Let's use @font-face to combine them
*/
body {
font-family:'Lucida Improved','Lucida Grande','Lucida Sans','Lucida Sans Unicode',Verdana,sans-serif;
}
@font-face {
font-family:'Lucida Improved';
/**
* Soma HTML5 CSS Reset. Assumed an HTML5 shiv for IE < 9
* Builds from http://meyerweb.com/eric/tools/css/reset/
*/
html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,big,cite,code,del,em,font,img,ins,small,strong,sub,sup,tt,b,u,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;}
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block;}
ol,ul{list-style:none;}
blockquote,q{quotes:none;}
blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;}
a:focus{outline:1px dotted;}
@mattwiebe
mattwiebe / sd_mail_killer.php
Created December 21, 2010 01:25
A simple class to override WP's email functionality to debug/inspect what will be sent. Put in your mu-plugins directory.
<?php
/*
Plugin Name: Mail Killer/Logger
Description: A simple class to override WP's email functionality to debug/inspect what will be sent. Put in your mu-plugins directory.
Version: 1.0
Author: Matt Wiebe
Author URI: http://somadesign.ca/
License: A "Slug" license name e.g. GPL2
*/
@mattwiebe
mattwiebe / sd_lessn.php
Created January 11, 2011 18:25
Lessn More integration for WP
<?php
/*
Plugin Name: Lessn Shortlinks
Description: Integrates WP's shortlink functionality with the <a href="http://lessnmore.net/">Lessn More</a> URL shortener. <em>Hasn't been tested with vanilla Lessn, but the API should be compatible.</em> (Edit the file manually to configure)
Version: 1.0
Author: Matt Wiebe
Author URI: http://somadesign.ca/
*/
/**
@mattwiebe
mattwiebe / sd_list_authors.php
Created January 23, 2011 23:49
An slight mod of wp_list_authors to optionally add a class to the current author in an author archive.
<?php
/**
* List all the authors of the blog, with several options available.
* Edited to optionally include current-author class on author archives
*
* <ul>
* <li>optioncount (boolean) (false): Show the count in parenthesis next to the
* author's name.</li>
* <li>exclude_admin (boolean) (true): Exclude the 'admin' user that is
@mattwiebe
mattwiebe / cleaner_menus.php
Created February 8, 2011 06:45
Clean up the cruft on WP-generated menus
<?php
/**
* De-cruft WordPress-generated menu HTML
* @author Matt Wiebe
* @link http://somadesign.ca/
* @contributor Roger Johansson {@link} http://www.456bereastreet.com/archive/201101/cleaner_html_from_the_wordpress_wp_list_pages_function/
* @license GPL v2 {@link} http://www.opensource.org/licenses/gpl-2.0.php
* @copyright 2011
*/
class SD_Cleaner_Menus {
@mattwiebe
mattwiebe / post-numbers.php
Created March 16, 2011 18:21
Post numbering function for WordPress
<?php
/**
* Display a post count on WordPress posts
* Just use mw_post_number() inside the loop and you'll get a post number count
* @author Matt Wiebe
* @link http://somadesign.ca/
* @license GPL v2 {@link} http://www.opensource.org/licenses/gpl-2.0.php
* @copyright 2011
*/
@mattwiebe
mattwiebe / conditional-html.php
Created April 8, 2011 05:11
Conditional <html> for WordPress
<?php
/**
* The WordPress answer to:
* @link paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
* @author Matt Wiebe
* @link http://somadesign.ca/
* @var $min int minimum version of IE to target.
* @var $max int maximum version of IE to target - will receive no IE-specific classes.
*/
@mattwiebe
mattwiebe / no_querystrings.php
Created April 18, 2011 22:39
Gets rid of WordPress's (annoying) usage of querystrings for versioning.
<?php
add_action( 'wp_enqueue_scripts', 'piss_off_query_strings' );
function piss_off_query_strings() {
global $wp_scripts, $wp_styles;
foreach( (array) $wp_scripts->registered as $handle => $obj ) {
$wp_scripts->registered[$handle]->ver = null;
}
foreach( (array) $wp_styles->registered as $handle => $obj ) {
$wp_styles->registered[$handle]->ver = null;