WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 12 of 36

.htaccess for cookie-less image domain

Here is a choice collection of .htaccess directives that I use when hosting images on a subdomain. When doing so, it’s best for performance to make sure the domain or sub-domain is “cookie-less”, so there is no time wasted sending cookie data back and forth between the server and client. Other optimizations are included to […]

PHP check if file exists by URL

This quick PHP snippet can be used to check if a specific URL exists. I use this in one of my projects for checking the existence of a robots.txt file on the site. Can be modified to check for files on any publicly accessible site.

PHP Get Actual IP Address

Here are a couple of quick snippets to get the visitor’s actual IP address via PHP.

Combine & compress CSS files with PHP

Here is another technique for combining multiple CSS stylesheets into a single, compressed file.

WordPress check if plugin is active

Developing WordPress plugins, it’s super useful to know if another specific plugin is active. Fortunately WordPress makes it easy to do, read on to learn how..

PHP List All Directory Files

Here are three ways to list all files in a directory via PHP: via iterator class, file function, and while loop (in order of preference).

Get the Current URL in WordPress

Quick tip: get the current URL in WordPress:

Advanced search for custom post types

Setting up custom search forms for custom post types can be tricky business. Here’s a quick & easy guide to make it happen in two steps.

Remove borders & outlines in IE

For the DigWP redesign, I noticed that some linked images were displayed with an unwanted border (or outline) in IE. After the usual CSS techniques failed to work, I experimented a bit and discovered a simple solution.

Set X-UA-Compatible via .htaccess

It’s relatively well known that you can set X-UA-Compatible headers with HTML.. here is how to do it with a bit of .htaccess.

Secure WordPress Login Page

If you try to log in to some of my WordPress-powered sites via the WP Login Page, you will be met with a 403 “Forbidden” response. For sites where I am the only registered user, I lock things down to prevent endless waves of drip force attacks. It really helps to reduce server load, conserve […]

WordPress Allow HTML in Author Bio

By default, WordPress filters out any markup included in the description (bio) of user profiles. Here is a code snippet to allow HTML in author bios.