A few guidelines for WordPress plugin development

The WordPress plugin API is vast and powerful. It allows developers to essentially hook code into almost any area of the WordPress system without modifying the core files at all. It also allows for the creation of standalone plugins that work within the WordPress system but do not hook into the core modules.

Over the last few weeks, WordPress plugin development has become one of my favourite things to do. I find it exciting to be able to create functionality, incorporate it seemlessly into the WordPress system and see it work smoothly with the other modules. While plugin development for WordPress is incredibly powerful, it also carries with it a few areas where people commonly stumble over and potentially lose interest in their code… which could be the next big thing. Here are a few guidelines I’ve picked up in order to step over the stumbling blocks.

Coding with the other side of your brain

This might seem like a weird topic for a blog post. Let me elaborate.

If you’ve ever coded for a system that is build in a convention you’re not used to (for example, coding using a MVC framework, if you’re not used to it), this concept will begin to make sense. It refers to the almost complete paradigm shift required when approaching an unfamiliar coding framework or system. Here are a few things that I’ve found ease the process of coding with the other side of your brain.

My WordPress plugins toolbox

Hey everyone,
Just thought I’d post a list of my most regularly installed WordPress plugins and why they are installed on virtually every WordPress installation I do. If there are any plugins I haven’t listed that should be, please let me know in the comments. 🙂

1. Maintenance Mode

This plugin is truly awesome. It allows the developer and end-user to test the WordPress installation thoroughly, on the server where it will eventually be hosted, without displaying it to the world. It also allows the user to, as it says in the title, take the website down for maintenance at any stage and leave a message for users letting them know of the downtime.

Getting the information of a root page in WordPress

Often, when using WordPress as a content management or blogging tool on a website, one uses a multi-level page structure. This entails a page being listed “underneath” another page in a tree structure. Usually, if your WordPress installation’s permalinks deviate from the default setting, your page URL structure will look something like this:

http://websiteurl.com/parentpageslug/subpageslug (Note: note a real URL)

What if you require a value to be set depending on the highest level parent page? The process looks like this:

Knowing when to extend the goal posts

A few months ago, David and Marc posted a video blog entitled “Setting small goals to achieve big ones“. This video focussed on how to rather set lots of smaller goals that are easier to atain than one or two big goals. This approach can be most effective when the smaller goals are set and met on time.

Recently, I’ve discovered an additional tip on this topic. My thoughts were prompted by the following notion: Setting small goals in order to achieve a fewer bigger goals is an effective method of working. What happens though, when the smaller goals and the bigger goal have both been achieved? The answer is simple.

WordPress Shortcodes… in short

In the spirit of the topic, I’ll keep this post short and sweet. Today I’ll be discussing WordPress’s shortcode API and how to utilise it.

WordPress shortcodes are codes (eg: [list_bookmarks]) which can be typed into the content area of a page or post in order to provide functionality of some kind. Shortcodes can be wrapped around text (similarly to how HTML tags are wrapped around text) or can be used as a single tag. In this post, I will discuss using shortcodes as a single tag to save time as well as providing more control to the user of your WordPress theme/plugin/function.

Useful HTML characters reference

While searching for a specific character (→ to be exact) I stumbled upon this great resource for HTML character entities. It can serve as a great resource for common characters used in web design (copyright symbols, etc) as well as other characters (for example, replacing a ^ with ↑ in a “back to top” link on your website).

I hope you guys find this as useful as I have today. 🙂

View the HTML characters reference.

HOW TO: Use your mobile phone as a modem for your Mac

I’ve wanted to try this out for a while now, and it works surprisingly well. In fact, I’m using it to type this post. Anyways, onto the ‘how-to’.

What you’ll need is a laptop or desktop Mac (I’m on a Macbook) and a mobile phone that supports bluetooth and a 3G connection of sorts (any kind of data transfer connection should work fine). Let me first lay out what we’re aiming to do here, step by step. We want to connect our laptop or desktop to the phone via bluetooth, and to use the phone’s data connection as a means of accessing the web. Here’s how we do this:

Custom WordPress Widget – Recent Posts

I’ve just finished the first round of coding of a widget idea I had for my blog this afternoon. This widget is to display recent posts. Yeah, I know, a “recent posts” widget comes bundled with WordPress. This widget is different. 🙂

In a short sentence, this widget does the following: “Give me a maximum of the latest X posts that aren’t the first X posts, and display them in a list. If there is a custom field that holds an image, grab it’s value and display the image as a square thumbnail”. The reason for this blog post is more to discuss a few things I learned while coding this widget.