Stephen Harris
Stephen is a Mathematician, Christian & WordPress developer all rolled into one, oddly human shape. He's the author of the event management plug-in Event Organiser.
  • Code
    Data Sanitization and Validation With WordPressSanitization and validation preview
    Proper security is critical to keeping your site or that of your theme or plug-in users safe. Part of that means appropriate data validation and sanitization. In this article we are going to look at why this is important, what needs to be done, and what functions WordPress provides to help.Read More…
  • Code
    The Rewrite API: Post Types & TaxonomiesPreview
    This is part two of a series looking at WordPress' Rewrite API. In part one we took a whistle stop tour of the basics of WordPress' Rewrite API. In this tutorial we will look at the rewrite settings available to us when registering a post type or taxonomy. While custom post types and taxonomies (unlike the default posts, categories and tags) don't benefit from any Settings -> Permalink interface, setting up rewrites for custom types is still fairly straightforward. We'll also be using the methods introduced in part one, so if you haven't already I recommend you read WordPress' Rewrite API Part One: The Basics.Read More…
  • Code
    The Rewrite API: The BasicsPreview
    This is part one of a two part series looking at WordPress' Rewrite API. In this tutorial we look at how rewrites work and the basic methods available to create custom rewrite rules.Read More…
  • Code
    Understanding the Walker ClassPreview
    Menu items, pages and (hierarchical) taxonomies are all examples of data with a tree like structure: terms can have parents, children and siblings. Usually we would like to reflect this structure in the HTML markup. For displaying a menu, for instance, we want the HTML to be of a list of 'top level' links, with nested lists of their children, which themselves contain nested lists of their children, and so on. This tutorial will guide you through a class WordPress provides which makes producing this mark-up extremely simple.Read More…
  • Code
    Add Post Type Archive Links to Your MenuPreview
    A common request, particularly for those who have created custom post types like 'News' or 'Events', is to add a link to their post type's archive page on their navigation menu. Currently, however, this can only be done by manually entering the post type archive URL. Apart from being fairly inelegant, this solution has a few drawbacks: it doesn't always appear as 'current', if you change your permalink structure it could break the link, manually adding the URLs is tedious and the link does not appear as 'current' when on a post of that post type. In this tutorial I will show you how to produce a plugin that creates a meta-box on your Appearance -> Menu page which allows you to add post type archive links. These links don't suffer from the drawbacks mentioned above.Read More…
  • Code
    Publishing WordPress Plug-Ins With GitPreview
    If you've got a plug-in hosted on the WordPress repository then you'll be fairly familiar with SVN and some of its commands. In this tutorial I'll show you how you can use Git, another version control system popularised by GitHub, to publish and maintain your plug-in.Read More…
  • Code
    Add jQuery Autocomplete to Your Site's SearchPreview
    The function get_search_form() can (and should!) be used to display the search form for your site. It does the job, but it's very bland. Shipped with WordPress since 3.3, however, is a tool which can make using it a lot easier. In this tutorial I'll be showing you how to add jQuery Autocomplete to your search form.Read More…
  • Code
    Quick Tip: Make Your Custom Column SortablePreview
    In a recent article by Claudio Simeone, he demonstrated how you could add extra columns to your post, or custom post type, admin screens (or remove existing ones). In this quick tip I build on that by showing you how to make your newly created columns sortable.Read More…
  • Code
    How to Use Radio Buttons With TaxonomiesPreview
    WordPress' custom taxonomy features are fantastic, allowing you to organize your posts in various taxonomies, with all the hard work done for you. However, it can also be a bit constraining. When editing your posts, your taxonomy terms have their own metabox, and they appear either as a checkbox list (for hierarchal taxonomies) or as a tag cloud (for non-hierarchal taxonomies). Those are your two choices. This can present a problem when you want to ensure only one term can be selected for each post. Of course, you could hook into the save_post hook and remove any 'excess' terms, but this is not particularly user-friendly and certainly doesn't provide a great user interface. Sometimes, it would just be more aesthetically desirable to present your taxonomies in a different way. This article will show you how to do just that, and all the code we talk about should be added to the functions.php file in your theme. We'll focus on radio buttons, but you could use any other input method, for example a drop-down menu.Read More…