Last week I wrote about how to widgetise your theme, and explained how to turn your sidebar into a dynamic sidebar, allowing you to add widgets from within your admin panel, rather than manually coding them into the sidebar. We can now take this one step further and create multiple sidebars/widget ‘blocks’. These don’t have to always be a full length sidebar, they could be two or three sections in the …
If you want to use widgets in your WordPress theme, or you’re a theme developer and want to make your theme ‘widget ready’, then all it takes is a couple of steps to add the necessary code in and your theme is good to go.
The Function
First we need to register the sidebar in our functions.php file (if you don’t have a functions.php file, create one). At the simplest form this is
[sourcecode language="php"]if …
If you create WordPress themes then a useful addition to a standard theme is to give the user a simple way to change the logo or header in use, perhaps allow them to change the colour of the background, the width of the site too. These options are designed to save people time but more importantly, to make it easy for non-developers to make a few alterations to their theme without needing …
When creating your own plugins you’ll often want to add one or more admin pages to allow users to configure options and add content, depending on what your plugin does. A couple of weeks ago I explained how to add an Options Page, this week I’ll run through how to add pages to other sections.
Creating a Submenu Page
The syntax of using these predefined functions is the same as using the options …
This is the final part on the subject of creating a WordPress plugin (read part 1 and part 2). We’ll be modifying our original function, that outputs social bookmark links after each post, so that it works with our new options page.
So first we need to modify our display function. At present it just echos out the markup, however we need it to do the following
Put the markup into a …
Last week I explained how to take a function and turn it into a plugin for your WordPress site. The plugin was fairly basic, just a function that created a list of social bookmarks. To use it you would just make a call to the function within your template file. However, we can go one better and give the user an option of either controlling where the bookmarks are displayed (as …
Over the past couple of months we’ve started to look at creating functions and using actions and filters in our functions.php theme file to help manipulate the content output by WordPress. If you create something and feel it’s worthy of releasing for others to use then rather than just posting the code up for others to copy, it’s usually better to write a plugin.
To start a plugin file off you use a …