WP-Mix

A fresh mix of code snippets and tutorials

Replace content in WordPress header.php

Here’s how to filter content in WordPress’ header.php template file using PHP.

Targeting different versions of IE

Honestly I can’t stand Internet Explorer. But people still use it, so here’s a few ways (via jQuery & CSS) to target different versions of IE.

FeedBurner .htaccess redirect

Need to redirect your feeds to FeedBurner? Here’s how to do it with a thin slice of .htaccess.

Remove www and index.php from URL

Here’s a handy .htaccess snippet for canonicalizing URLs by removing the “www”, “index.php”, and “index.html” from all requests.

jQuery switch styles

Switching CSS styles on click (or other event) is easily accomplished with jQuery. Here are two examples showing how to use jQuery to switch styles.

jQuery browser detection

Here’s a tasty little snippet for adding custom browser classes using jQuery.

Require user login for any plugin

Here’s a quick trick to require user-login for any plugin. For example, if you want users to be able to use your chat plugin only if they are logged in. Here’s how..

Add titles to previous_post_link & next_post_link

Here’s a quick way to include a title in previous_post_link() and next_post_link().

Simple jQuery tooltip

There are many great jQuery plugins for creating tooltips, but for simple cases only a few lines of code are needed.

Display category name in WordPress

Here are two snippets for displaying the category name and displaying the category link in WordPress.

Shorten text with CSS

There are several ways to shorten text, depending on the situation and goals. It’s preferable in most cases to shorten text server-side via PHP, but also possible to shorten via jQuery or even CSS.

Simple live comment preview with jQuery

Here is a very simple and basic live-preview for comments and contact forms.