Using Widgets In Wordpress

September 13, 2008

Widgets allow Wordpress users to easily add in new features to the sidebars of their templates without having to hack template code.

e.g. you can add a translator widget that will translate your page into multiple languages, or you could add a Feedburner subscription box.  Adding both of these (and the hundreds of other widgets available) would require editing of the sidebar templates if it were not for widgets.

To add widgets to your sidebar, first step is to download and install the widget.  Widgets are installed as plugins.

Let’s take the global translator as an example.

You can download the global translator here.

Upload and activate the plugin by following the instructions on how to install Wordpress plugins.

Once the plugin is installed, go to the Design –> Widgets menu (note: I am using the Lighter Menus plugin so that my Wordpress menus drop down):

 

widgetsmenu

You will now see the Translator widget listed in the widget list:

globalinwidgets

On the right hand side of the screen, you need to select the sidebar that you want to insert the widget into.

whichsidebar

Note: Your template may not have more than one sidebar.  Mine has three, and I want to insert it into Sidebar 2.  Select the sidebar from the drop-down menu, and click the “Show” button.

Now, click the “Add” link next to the Global Translator Widget on the left.  You will see it appear on the right under your sidebar:

 

translator added

You can click on the “Edit” link next to the Global Translator widget (on the right) to edit the properties of the widget.

In this case, the widget has no options, so simply click the “Save Changes” button to add the widget to your site.  On refreshing your site, the Translator widget now appears in Sidebar 2:

 

translator on site

 

I have just shown you one widget.  There are a lot of widgets available, but the method of installing them is the same in each case.  Once you install a widget, do check that it works.  Widgets need to be upgraded as you upgrade your Wordpress installation, but fortunately most will alert you on the plugin page when a new update is ready.

Manual Upgrade of Wordpress

September 5, 2008

It has happened a few times to me.  The automatic upgrade plugin for Wordpress hasn’t worked.  The last time this happened was with Wordpress release 2.6.1. and it happened on all of my blogs.  Is it a hosting issue, or a plugin issue?  I am not sure, but what I am sure about is that I need to upgrade manually.  It’s one of those scary things the first time you have to do it, because you’re not too sure whether your site will still be functioning at the end of it all.  However, after having completed the procedure several times, I wanted to show you how easy it really is.

NOTE: Since writing this tutorial, I have found that manually deactivating all plugins (except the automatic upgrade plugin) before starting the automatic upgrade procedure fixed the problem with the upgrade failing.

The first sign that you need to upgrade will be in your Wordpress Dashboard.

needtoupgrade

You can see the Automatic Upgrade plugin kicking in, however, after trying this, it didn’t work.  Here is how to manually upgrade Wordpress to 2.6.1.

NOTE: Backup everything before you try this, and I accept no responsibility if things go wrong.  If you try this, you try it at your own risk.

1. Download WordPress 2.6.1.

2. Backup your database.  If you have the Lester Chan’s excellent WP-DB Manager plugin activated, backing up is very easy.

3. Backup all of your Wordpress files for the existing installation.

4. Deactivate ALL plugins.

5. You need to delete the old Wordpress installation, but there are some files/folders you do not delete.

Do not delete:

  • wp-config.php
  • wp-content folder, but you do delete the wp-content/cache and the wp-content/plugins/widgets folders.
  • wp-images folder;
  • wp-includes/languages/ folder if it exists
  • .htaccess file
  • robots.txt file

Delete:

  • wp-admin folder
  • wp-includes folder (but not the “wp-includes/languages/” folder if it exists).

NOTE: I actually don’t delete these, but simply over-write them.  I have not had a problem doing this instead.


6. Open the wp-config-sample.php file that comes with the latest version of Wordpress in a text editor.

Open up your old wp-config.php file, and enter your old MySQL Settings AND the table prefix into the new wp-config-sample.php file.  NOTE: This step is not in the online upgrade page at Wordpress.org, but it is a necessary one since in 2.6.1. the wp-config.php file has some additional lines for security keys:

wp-security-config




Get your authorisation keys for lines 13, 14 & 15 of the wp-config-sample.php file from http://api.wordpress.org/secret-key/1.1/.  That link will give you three lines that you can copy and paste over the top of the existing lines in the sample file.

7. When you are 100% sure that your database settings and table prefix are correct in the sample file, rename the newly edited wp-config-sample.php as wp-config.php.

8. Upload the new version of Wordpress Files.

9. Run the upgrade program by typing in http://mydomain.com/blog/wp-admin/upgrade.php

NOTE: Replace the “mydomain.com/blog” part with the location of your Wordpress installation.

You’ll see this screen:

upgradewpdatabase

Click the Upgrade Wordpress Button, and hopefully you will see:

wp-upgrade-complete

Click the continue button and you should be taken to your blog.

Logging into your blog Dashboard should now show that you are using the latest version.

wp-upgrade-complete2[5]

10. At this point, you need to reactivate the plugins, and update any that may not be compatible with the new version of Wordpress.  However, the official updates instructions say to update permalink structure and htaccess files, so maybe this is necessary if you actually delete the files and folders above (instead of over-writing them as I do).

Be aware that although I have not had any problems using my “over-writing” process rather than deleting and re-uploading, there is no guarantee that this procedure will always work.


You may see this message:

wp-cleanup

This message comes from the Wordpress Automatic Upgrade plugin.
Click the link to clean up and remove the nag.  You’ll then see:

wp-cleanup-successful


You should now be good to go.  Happy blogging!