WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 1 of 28

Redirect HTTP to HTTPS

In addition to www canonicalization, you can also canonicalize the HTTP protocol, redirecting HTTP to HTTPS (or vice versa) with .htaccess.

Protect Plesk stats

An important aspect of website security is protecting sensitive data such as your server statistics. Here is an important security tip for Plesk users.

WordPress 404 email alerts

Here is a customized plug-n-play PHP script for reporting 404 errors via email. No editing required, just clean email alerts for each 404 error.

Fade in page content with jQuery

Here are two simple techniques to fade in page content with jQuery. The fade-in effect isn’t for everyone, but it’s a nice tool to have in the box.

Maintenance mode via .htaccess

For WordPress users there are at least three great plugins that make maintenance mode just dead-simple. Even so, here is how to do it with .htaccess.

Break Out of Frames for WordPress

Quick JavaScript snippet to prevent scrapers and turds from framing, defaming, and/or stealing your precious content..

Redirect URLs with .htaccess

Here is a quick cheat-sheet for redirecting URLs with .htaccess.

Disable external URL requests

During development there may be situations where you want to prevent WordPress from making URL requests to external websites. Here is a simple way to disable external URL requests during development.

View all WP query variables

Micro Tip for the day: slice of PHP code for viewing all WordPress query variables. Very useful for figuring out custom loops and such.

PHP Compress CSS & JavaScript

Quick snippets for compressing CSS and JavaScript with PHP’s ob_gzhandler, which will gzip or deflate content depending on browser support.

CSS transition effect for links

CSS transitions can add a nice effect to links. Here are some quick example snippets for your copy/paste enjoyment.

Set attachment as featured image

Here’s how to set the first attachment as the featured image for posts in WordPress. This is useful for User Submitted Posts, which attaches uploaded images to each submitted post.