Obtaining Plugins


If you want to use a plugin that isn't part of a standard WordPress installation, you'll have to obtain a copy of it. How you do this depends on how the plugin is made available:

  • Most plugins are available as downloads. You click a link and download the plugin or an archive file containing the plugin and support files.

  • Some very simple plugins are available only as plain text viewable in your Web browser. The code for these files must be copied and pasted into a plain text file and saved on your computer.

In this section, we explain how to use either method to obtain a plugin.

Tip

  • Some plugins are available only from the plugin author's Web site.


To download a plugin

1.

Locate the plugin you want through an Internet search or a plugin directory.

2.

Click the appropriate link to download the plugin to your computer (Figure 2).

Figure 2. Click a download link to download the plugin.


3.

If a dialog like the one in Figure 3a or 3b appears, choose an application from the menu and click OK.

Figures 3a & 3b. A dialog like this may ask how you want to open the downloaded file. These illustrations are from Firefox for Windows (top) and Firefox for Mac OS (bottom).


The plugin file(s) should appear in your default downloads location (Figure 4).

Figure 4. An example of the contents of a plugin archive file.


Tip

  • Most downloadable plugins are archived with the ZIP compression scheme. Step 3 normally opens the archive file so you can see and use its contents. If the file is downloaded as a ZIP file and is not opened automatically, you can double-click its icon to open it.


To create a plugin file from a code listing

1.

Locate the plugin you want through an Internet search or a plugin directory.

2.

Click the appropriate link to display the the plugin file's code in your Web browser window (Figure 5).

Figure 5. When you click a link to a PHP file, Safari displays the file's code in a Web browser window.


3.

Select the text of the plugin from the opening <?php to the closing ?>.

4.

Choose Edit > Copy or press (Windows) or (Mac OS).

5.

Open your favorite text editor application and use it to create a new, empty text file.

6.

Position the insertion point in the new document and choose Edit > Paste or press (Windows) or (Mac OS). The PHP code is pasted in (Figure 6).

Figure 6. Paste the PHP code into an empty text file. In this illustration, invisible characters are displayed so we can track down and kill extra characters at the beginning or end of the file.


7.

If necessary, delete any extra text or other characters from the start and end of the document. The file must start with <?php and end with ?>.

8.

Save the file with the name suggested by the creator of the plugin. Be sure to include the .php file name extension.

Tips

  • How a PHP file appears depends on your browser. For example, although clicking a link in Safari displayed the code you see in Figure 5, clicking the same link in Firefox offered to download the file as instructed on the previous page.

  • Don't skip step 7! You may see an error message in your blog (Figure 7) if a plugin includes any extra characters.

    Figure 7. Here's an example of an error message that might appear if a plugin file includes extra characters. A similar message might appear if a plugin file becomes corrupted.

  • To help identify extra characters, it's a good idea to show invisible characters when working with PHP files in your text editor (Figure 6).





WordPress 2. Visual QuickStart Guide
WordPress 2
ISBN: 0321450191
EAN: 2147483647
Year: 2004
Pages: 142

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net