Formatting JSON With PHP

July 17th, 2012

The built-in json_encode() function in PHP puts everything on one line. For development and debugging, it can often be more useful to have properly indented, human-readable JSON that makes it easier to manually inspect the encoded data and check it for problems. Here’s a function that lets you format/pretty-print any JSON string to be more […]

Continue Reading...

How To Use The Default Admin Menu Icons In Your Plugin

July 10th, 2012

As you probably know, you can use the add_menu_page() function to create a top level admin menu for your WordPress plugin or theme. This function allows you to specify a menu icon by passing an image URL as the $icon_url argument. But what if you want to use one of the default admin icons – […]

Continue Reading...

List Of WordPress Plugin Frameworks

June 26th, 2012

For plugin developers desiring an easier way to perform common tasks, a little more structure in their code, or perhaps even a dash of MVC goodness, here is a list of WordPress plugin frameworks. This list is intended to be comprehensive. If you find an actively maintained plugin framework that’s not listed here, let me […]

Continue Reading...

How To Create A Table Of Contents Shortcode

June 19th, 2012

It’s time for another WordPress plugin development tutorial 🙂 In this post, I will provide a step-by-step explanation of how to create a WordPress plugin that lets the user add an automatically generated table of contents (TOC) to their posts by using a simple shortcode. The completed plugin will support the following syntax: For example, […]

Continue Reading...

How To Easily Stop Your Site From Being Loaded In A Frame

June 7th, 2012

As of WordPress 3.1.3, it’s really easy to prevent unscrupulous web developers from displaying your site in a frame. Just add this one-liner to your functions.php file: Now any other site that tries to load your WP blog in a frame will get this instead: (The actual error message will vary depending on the browser. […]

Continue Reading...