WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 12 of 35

Combine & compress CSS files with PHP

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

PHP Get Actual IP Address

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

WordPress.org Login URLs and User Profile Pages

Working as a developer at WordPress.org means that I get to log in and help people, update my plugins, and make sure my profile information is current. For quite awhile, however, I was confused about the various URLs that are involved with logging in and managing profiles, preferences, and so forth.. The whole WordPress.org domain […]

WordPress Create New User

Two ways to programmatically create new users in WordPress. The first method uses wp_create_user() and the second method uses wp_insert_user().

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:

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..

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.

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.

Proper usage of get_search_query()

This tutorial explains the two ways to properly use WordPress’ template tag, get_search_query(), depending on context. Note that the information provided in this post also applies to the similar tag, the_search_query().

Canonical snippets for WordPress

.htaccess enables us to easily clean up 404 errors and other misdirected HTTP traffic for better SEO. Here are some canonical snippets for WordPress and beyond.