WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 3 of 33

WordPress: check if user is logged in

Here are some notes and examples of how to check if a user is logged in to WordPress.

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.

PHP Detect All Versions of IE

Quick code snippet for detecting all versions of good ’ol IE (Internet Explorer).

PHP Spoofing Headers with cURL

While working on a recent book-sale script, I needed a way to test various request headers. This script is what I used to spoof just about everything except the IP address (which it seems is not possible to spoof via PHP/cURL).

View all WP Post variables

Quick tip to view all WP Post variables, which can be useful for development and debugging in WordPress.

JavaScript redirect to URL on select

JavaScript and jQuery techniques for redirecting to the specified URL when the user makes a selection.

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.

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.

Font Smoothing in Chrome & Firefox

Working with text in Chrome (and other Webkit-based browser) and Firefox can be frustrating. Depending on context, certain fonts may be displayed weird: too heavy, too fat, too thick, and so forth. So much so that the text can look distorted and difficult to read. Fortunately, we can apply the CSS font-smoothing property to make […]

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.