Popular Posts
All posts ordered by popularity
Exclude pages from WordPress search results
By default WordPress includes all of your blog’s pages in its internal search results.
WordPress shortcodes for private content
I use these snippets all the time, so I’m posting them here at WP-Mix for easy access. The first shortcode can be used to display content only to logged-in users (based on capability). And the second shortcode can be used to display content only to visitors (non-logged-in users).
jQuery switch styles
Switching CSS styles on click (or other event) is easily accomplished with jQuery. Here are two examples showing how to use jQuery to switch styles.
Fix Database Won’t Start Error for MAMP Pro
I use MAMP Pro for some of my local pet projects and development. Normally it works great, but the other day I couldn’t get MySQL started. It kept crashing during startup. This post explains the related errors and how I managed to resolve the issue and get MAMP working again.
Tip for resizing images
Here is a quick tip for getting clearer images when reducing their size at web resolution 72dpi.
PHP Protect Include Files
Including files plays an important role in PHP development. For example, your app may consist of a main plugin file that includes several smaller files, each of which contains some distinct bit of functionality. When including such files, it’s a good idea to protect them against direct access. This tutorial rounds up a bunch of […]
Remove All Matching Options from the WordPress Database
Typically when you want to remove an option from the WordPress database, you can use a function like delete_option(). But there are cases where such functions are insufficient. For example, in a previous version of my plugin Blackhole for Bad Bots, a database option is added for each blocked request, and each option name includes […]
Enable shortcodes in widgets
Quick tip to enable WordPress shortcodes to be executed in widgets (and post content).
jQuery: Remove parent element containing empty span
This tutorial explains how to remove the parent of an element that contains an empty <span></span> (or any empty element). First I’ll explain where it might be useful, and then share the magical code to make it happen.
Force download WMV with .htaccess
Everyone loves WMV! Not! Jokes aside, here’s what finally worked for me when trying to force download Windows Media Video (WMV) files.
WordPress Remove Screen Options
Normally the “Screen Options” tab is an awesome little WordPress feature. Located on various screens in the WP Admin Area, the Screen Options tab toggles open any available settings. Like which meta boxes to display, layout columns, editor auto-height, and other options depending on which screen you are viewing. But there may be cases where […]
PHP Shorten String by Character Count
Quick copy-n-paste function to truncate or shorten a string of text to a specific number of characters. Useful for things like “next” and “previous” navigation links and so forth.