Latest news in WordPress Coding & Design
WordPress Theme Inheritance
WordPress Coding & Design The WordPress template system has a relatively unused gem in the template system, Theme Inheritance. Theme Inheritance allows you to set your theme to inherit files from a parent theme, meaning you could create your theme in the colours you choose, but then you can create a number of new themes with just a stylesheet in them, and set each stylesheet to inherit from the main theme, and then just override the styles set. So, if we use the example ...
Continue readingAdding custom icons to your WordPress theme
WordPress Coding & Design If you are using a WP framework it is quite simple to modify the background images and icons set up with the theme. Some of the more powerful themes even allow you to upload new images from right inside the admin area. However, if you’re using something a little simpler, most of the time you have to go in and manually add images to your theme the old fashioned way. If your theme falls under the latter, we’ve got the quick and dirty ...
Continue readingWidgetise Your Theme Part II
WordPress Coding & Design 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 footer of your site, or ...
Continue readingWidgetise Your Theme
WordPress Coding & Design 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 ( ...
Continue readingCreating Theme Options
WordPress Coding & Design 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 to go looking through the code. So first we need to create ...
Continue readingPlugin Administration Menus
WordPress Coding & Design 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 page function. To remind ourselves, ...
Continue readingCreating a WordPress Plugin III
WordPress Coding & Design 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 variable Check which option is set If you should attach the ...
Continue readingCreating a WordPress Plugin II
WordPress Coding & Design 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 it currently is), or for those less confident in editing their ...
Continue readingCreating a WordPress Plugin
WordPress Coding & Design 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 PHP comment to contain the ...
Continue readingCreate a Breadcrumb Trail II
WordPress Coding & Design Last week I wrote about creating a breadcrumb trail, explaining how to do this for your front page, static Page and single post page. This leaves us with the category page and archives (day, month and year). Category Page The category page is quite similar to the single post page code that we saw last week, except that we use the single_cat_title() function along with the get_cat_id function to get the category ID of the page we’re on ...
Continue reading






