WP-Mix

A fresh mix of code snippets and tutorials

Block XSS with .htaccess

Quick snippet today that you can add to your .htaccess file to block some common XSS (cross-site scripting) attacks.

Private notes and members-only content

Two cool tricks today, shortcodes to display private notes and members-only content.

Shortcode for encoded email address

One way to help reduce spam is to encode your email address whenever displaying publicly. Here is a function that will do just that: display an encoded version of whatever email address you specify.

Replace all instances of a string in WordPress

Here is how to replace all instances of a string in WordPress.

Exclude pages from WordPress search results

By default WordPress includes all of your blog’s pages in its internal search results.

Enable shortcodes in widgets

Quick tip to enable WordPress shortcodes to be executed in widgets (and post content).

Custom title length

Quick tip for limiting the number of characters displayed in post titles. Limiting title length is useful in some design situations and is actually very easy to do.

Instant screenshots of any web page

Here’s a trick to instantly generate a screenshot of anything on the Web. Without a plugin.

Display the visitor’s Google search terms

A neat trick in your themes is to display the search terms used by the visitor somewhere on the page. Here’s how to do it for visitor’s arriving at your site after searching in Google.

Create a WordPress shortcode

Creating your own custom shortcodes is another thing that WordPress makes very easy to do.

Create WordPress widgets

WordPress makes it drop-dead simple to create your own custom widgets.

Display external files with a shortcode

Here is a cool snippet to display an external file anywhere in your WordPress theme.