WP-Mix

A fresh mix of code snippets and tutorials

Limit Characters in WordPress Navigation Links

Here is are two jQuery techniques to limit the number of characters in a string, applied to WordPress navigation links.

Add Custom Info to PHP System Log

Here is a quick function for adding custom information to the system log via PHP.

Convert NEF to JPG

I take a lot of photos and recently started shooting in NEF format (because I bought a Nikon). I like the quality, but had a difficult time (on several occasions) trying to find a way to convert the NEF files to JPG or PNG.

Recursively display images via PHP

Here is an easy way to display all images in a directory — including images contained in sub-directories.

Add links to HTML/CSS Validator

Here are some notes and markup examples for adding links to the W3C’s online HTML and CSS validators. This will enable your visitors to check any page on your site.

WordPress redirect logged in users

Nice WordPress snippet to redirect logged in users to any location. Also optionally redirect visitors who are not logged in to WordPress.

Resize Google Search iframe

I’ve integrated Google Custom Search at DigWP.com and Perishable Press. In doing so, I found it necessary to resize the google-search iframe in order to fit with the responsive layout.

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.

Browse your local files via browser

Ultra-quick tip for viewing/browsing files on your local machine in any browser.

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.

PHP: Target IE less than 9

Recently I haven’t had time to bother with old versions of IE (less than 9), so I use the following PHP function to target IE 6, 7 and 8.

Whitelist POST access with .htaccess

Here is how to whitelist POST requests for a specific file. For example, you can protect chat, forum, and other heavily targeted scripts from malicious acitivity.