WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 4 of 35

Detect Chrome, IE, Firefox, Opera, and Safari

How to detect each of the major browsers (Chrome, IE, Firefox, Opera, Safari) client-side via JavaScript.

WordPress Create Upload Files and Directories

This tutorial explains how to create new files and directories in the WordPress /uploads/ folder.

Additional file-types for mod_expires

Here is a list of the most common file-types for Apache’s mod_expires, which is used for configuring expires headers for better cache control.

All WordPress Login Parameters

Here is a list of all the query string parameters used on the WordPress Login Page. Knowing these can be useful when you are customizing the Admin Area and related functionality, so you can be sure to cover all the bases.

.htaccess Force GET or POST Requests

Here is how to force all HTTP requests to be either GET or POST. Easy to modify technique can be used for other types of requests as well.

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.

Remove the date from WordPress permalinks

With the rise of the “short URL”, including the date in URLs is no longer considered “cool”, so you may want to “get with it” and dumb down your WordPress URLs to make them shorter. Here is how to use .htaccess to remove the date from your WordPress permalinks.

Stop form spam with a hidden field

Sick of teh spamz? Here’s an easy way to block a lot of automated spam from your contact form.

PHP Add and Remove Query String Variables

Two quick functions, one for adding a query string variable and another to remove a query string variable. Either of these functions can be used in any PHP script to modify query-string parameters.

PHP Get Server Information

Here are some scrap PHP scripts leftover from my work on Dashboard Widgets Suite. These functions were considered specifically for use with the System Information Widget, and provide a variety of details about the current server configuration and software setup.

Remove ‘Private’ from private post titles

By default, WordPress prepends the string “Private: ” to all posts marked as “private”. Here’s a quick function to remove the private prefix and move on with your life.

Date and Time with PHP and WordPress

This post explains the difference between displaying the date and time with PHP vs. displaying the date and time with WordPress.