Difference between home_url & site_url
Here are some notes to help discern the subtle (and oft-confusing) differences between the WordPress functions, home_url and site_url (and their related “get” functions, get_home_url and get_site_url). We’ll look at the output of these functions and how they relate to the WordPress General Settings.
jQuery Auto Resize Multiple Textareas
The User Notes Widget that’s included in my Dashboard Widgets Suite plugin enables users to edit notes right on the WP Dashboard. To make things extra awesome, each note automatically expands as the user types more lines of text. This post explains how I achieved this trick, aka multiple auto-resize textareas.
Replace contenteditable with textarea
Working on my WordPress plugin, Dashboard Widgets Suite, I needed a solid way of replacing contenteditable with a textarea on form submit. Here is a simple solution along with some bonus notes on dealing with certain HTML tags.
WordPress Basic Allowed HTML for wp_kses
Here is a function that I use in my plugin, Dashboard Widgets Suite. It provides a sane, practical set of HTML tags and attributes for WP’s wp_kses family of functions.
jQuery check inline CSS property
Working on my WordPress plugin, Dashboard Widgets Suite, I needed a quick function to check a property defined via the inline style attribute on a specific element. Here is an easy, plug-n-play solution that works great.
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.
PHP output buffering example
PHP’s ob_start() and ob_get_clean() are useful for buffering output of printed content and so forth, but I use them very rarely and tend to forget their order/syntax. So this post provides a quick copy/paste example that I can grab the next time I need to output buffer something.
PHP Get Memory Usage vs. Total
Here is a useful function that I modified for my WordPress plugin, Dashboard Widgets Suite. It returns an array containing the current memory usage and the total memory usage, so you can get and display a ratio of the values as needed.
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.
WordPress Dismissible Admin Notice
Here is an easy snippet for adding a dismissible admin notice to any theme or plugin.
PHP check if file exists by URL
This quick PHP snippet can be used to check if a specific URL exists. I use this in one of my projects for checking the existence of a robots.txt file on the site. Can be modified to check for files on any publicly accessible site.
Coda 2 Shortcuts
This post is a working roundup of any/all useful shortcuts that I can find for Coda 2 (code editor and FTP software). So far, most of the shortcuts in this post are taken from Brad Strickland’s great post*. So huge thanks to Brad for sharing.