WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 22 of 35

CSS content for list items

Quick snippet for replacing default list-style types (bullets, discs, squares, etc.) with custom generated content in CSS.

Block BLEXBot via Apache/.htaccess

One of the worst bots I’ve encountered in a long time. BLEXBot likes to hit the same resources periodically and repeatedly. So it requests the same resources again and again, even if they are expressly forbidden via robots.txt or other methods. It’s like BLEXBot has no memory of where it’s been or what it’s doing. […]

Protect .svn files with .htaccess

For those using subversion, here is how to protect your svn files with .htaccess.

Lazy Load Tricks

I use Lazy Load for the sweet animated effects at Plugin Planet. Here are some code snippets for future reference.

Vanilla JavaScript: Focus Input on Page Load

Super quick tutorial today. How to focus the user on any input when the page loads. For example, when you visit the WordPress Login Page, the “Username” field is focused automatically. This technique is very simple and works on any input or element that supports a focused state.

WordPress Dismissible Admin Notice

Here is an easy snippet for adding a dismissible admin notice to any theme or plugin.

PHP fix exif_imagetype() error

Working on my plugin USP Pro, it’s become apparent to me that some servers for whatever reason disable the function exif_imagetype() function. So some users would get an error when trying to upload images. To resolve this, I added the following simple function to the plugin core.

WordPress: Display All Registered Image Sizes

By default, WordPress generates extra images for each image that is uploaded via the Media Library. These extra images are created in different sizes and are used for different things, like featured images and so forth. In addition to the default generated images, other image sizes may be added via themes and plugins. For example, […]

(More) secure PHP includes

Quick tip for securing your PHP includes, place them above your web-accessible root directory.

WordPress oEmbed Tricks

Ahh yeah, here are some sweet little code snippets to customize the default WordPress oEmbed functionality. Techniques include modifying default oEmbed size, markup, as well as enabling oEmbed for Post Excerpts and Custom Fields.

Find Password Protected Posts in the WordPress Database

Recently I needed to view all posts that were password-protected. Not finding a WordPress function for this, I wrote a quick SQL command to find all password-protected posts in the WordPress database.

Create a WordPress shortcode

Creating your own custom shortcodes is another thing that WordPress makes very easy to do.