Integration into your theme

If you want to integrate a SmoothGallery into your theme you can use the WordPress SmoothGallery plugin. There’re two ways to do this:

  1. You want a gallery in your sidebar? Use the widget.
  2. You want a gallery somewhere in your theme? Follow the developer howto.

Sidebar widget

The widget is pretty new. I’ll improve it soon…

The plugin comes with a widget that displays a gallery in your sidebar. This way it’s very easy to insert a gallery because you don’t need to know how to write PHP code. Since the widget renders the gallery inside an iFrame you can add as many galleries as you want.

Developer Howto

All you have to do is to implement the function insertSmoothGallery in the file config.php; you can find that file under wp-content/plugins/smoothgallery. Depending on your implementation the plugin makes sure that the CSS and JavaScript will be included inside your page.

Let’s say you want a timed gallery on the page with the id 4711 somewhere in your theme that’s 400×80 pixels. Open the file config.php and implement the insertSmoothGallery function like this:

function insertSmoothGallery() {
  # add all the conditional tags you're using to the array
  if (assert_functions_exist(array('is_page')) === false)
    return false;
 
  if (is_page('4711')) {
    return array('width'  => 400,
                 'height' => 80,
                 'timed'  => 'true');
  }
  return false;
}

Once you’ve done that put the HTML markup for the gallery somewhere inside your theme and you’re all set. No matter how you implement the function don’t remove the call to assert_functions_exist.

As you can see, I used the conditional tag is_page. These come in handy if you’d like to display the gallery on some specific pages only - if you don’t want that but a gallery on each and every page just remove the if statement and the corresponding curly brackets.

Just add another sidebar…

Instead of implementing the clumsy insertSmoothGallery function you can simply add another sidebar to your theme if you like that better. Think of it as a placeholder for widgets. It doesn’t necessarily have to be a vertical bar on the side - some horizontal thing in your header or footer is okay too.

So, maybe you want to have a look at the Widgets API and learn how to add another sidebar to your theme. Check out register_sidebar and dynamic_sidebar in particular; the page about the second function tells you how to manage Multiple Sidebars in your theme.

WordPress Extension Manager

Update (17. November 2008): I keep this page here for reference but since WordPress 2.7 there’s a Plugin Installer and even a WordPress Upgrader. This made this plugin obsolete and I won’t spend any time on it any more.

I’ve checked out various plugins for WordPress that might help me to administer my installed plugins and themes. I looked at:

I wanted a plugin that could do the following things:

  • install, update and delete plugins and themes
  • it should be able to handle various locations, i.e. at least these plugin repositories and maybe some from somewhere else.
  • basic search functionality for all these plugins and themes

Since I haven’t found something that could do all these things, I wrote the WordPress Extension Manager: a plugin that lets you do all of the above.

You can download the plugin here.

Installation

Unzip the downloaded plugin into your wp-content/plugins directory and activate it on the plugins screen. After that perform the following steps:

  1. change the permissions of the wp-content/plugins directory to 0777. Alternatively you can change the owner of this directory to the same user who is running the webserver.
  2. do the same thing you did in step 1 with these directories:
    • wp-content/themes
    • extension-manager/plugins
    • extension-manager/themes

Once you’ve done that you can go to Options - Extension Manager and start using the plugin.

Usage

You’re a geek? Read how this plugin works.

If you go to Options - Extension Manager you’ll be presented with these options:

  • Install Plugins
  • Install Themes
  • Maintenance

These actions will be described in the following sections.

Install plugins and themes

If you’d like to install a plugin or a theme simply hit the corresponding button and you’ll be presented with a list of all plugins or themes. You can use the Plugins per page dropdown list to show more plugins at once; the Next and Previous buttons help you to navigate one page forward or back.

If you’re searching for a plugin enter some search terms and press enter or click the Filter button. The results are plugins or themes that contain one of the words you entered in their name, version, download link or author link. In the future it will be possible to search the tags and maybe the description too.

Maintenance

This page shows all your installed plugins and themes. You can delete installed plugins or themes and if you’ve downloaded them with this plugin you can remove the corresponding downloads too.

If you want to delete a installed plugin or theme please make sure that you’ve deactivated it. In case you don’t care about some clutter in your database just delete the plugin or theme.

Notes

I’ve tested this plugin with WordPress 2.3.x but it should be possible to use it with earlier versions; just give it a try. I’ve only tested this plugin with PHP 5.2.x and if you’re using an earlier version of PHP some things might not work - please let me know and I’ll try to fix it. Alas, this plugin doesn’t work with PHP 4 and probably never will.