WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 30 of 32

Check for PHP cURL

Quick snippet for checking whether or not PHP’s cURL is available on the server.

Free Up Server Disk Space

Recently I spent some time clearing up more free space on my server. Here are some notes on things to check when doing so.

WordPress Change Excerpt Length

This code snippet is SO easy.. check it out if you want to change the default number of words included by default in WordPress excerpts.

Auto-Height for Ajax-Loaded Content

Here is a jQuery function for automatically setting the height of Ajax-loaded content.

WordPress: Display Site Creation Date

I’m surprised that WordPress doesn’t provide a function for getting the site creation date. Knowing when the site was set up can be useful for all sorts of things. Copyright dates. Bragging rights. Whatever. If you want to display the date your site was first installed, here is one way to do it.

PHP Stringify Formatted Text

This code snippet takes a string of text and removes all carriage returns, new lines, and tabs, replacing any matches with a simple blank space. An ideal way to “stringify” a potentially formatted lump of alphanumeric text.

WordPress Change Default Number of Displayed Posts

By default, WordPress displays the same number of posts for the home page (when it is set to display posts) and all types of archive views. To change the default number of posts displayed for any specific view, you can add this simple function to your theme’s functions.php file.

PHP Error Log Tricks

Super useful trick for customizing error logs when working with PHP.

Dealing with translation spam

How I respond to “translation spam”, which happens when greasy organizations ask permission to translate your script, extension, plugin, etc.

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. […]

Remove Linked Image Borders in IE

Internet Explorer has a nasty habit of displaying honking blue borders on linked images. This post shows a quick way to disable them using a slice of jQuery.

Truncate Database Table

Quick SQL code snippet that enables you to truncate any MySQL database table.