Suite101

How To Add Amazon Products In A WordPress Blog

Simple Tips for Getting Items Listed on your Weblog

© David Borrink

Jan 12, 2009
Amazon logo in WordPress Editor, David Borrink
The potential frustrations of adding Amazon Merchandise to WordPress posts is eased by the use of the Amazon Widgets Shortcodes plug-in.

Editors' Choice

While WordPress is one of the most popular blogging platforms available, the ability to add certain types of features within a blog post provides some challenges. One problem usually involves adding javascript codes for features such as Amazon merchandise links.

Hey, Where did the Code Go?

The editing window in WordPress has a cleanup function which checks a post and makes sure it will render properly once it’s up and running. This has the effect of taking pasted-in codes, such as the javascript codes which Amazon provides for their product links, and re-writing them or stripping them from the pages.

This can be very frustrating for the user. Fortunately, there are plug-ins which not only protect the added code, but also add helpful functions for entering the code. These plug-ins can even make the entry of code more efficient.

What are Shortcodes?

Shortcodes are special code containers. They indicate that the real code is located elsewhere on WordPress. This allows the function of the code to be on the page without the risk of getting rewritten or stripped. Think of it as a special "shield" around the code.

Amazon Widgets Shortcode is Easy to Use

The Amazon Widgets Shortcode plugin takes care of this issue for Amazon products. After installing and activating the plug-in, enter the Amazon Tracking ID supplied, and an Amazon pop-down menu appears in the visual editing window above a post (see example below).

In a new or existing post, place an insertion point where the Amazon item should appear and choose the pop-down menu. Select the type of Amazon feature to be used, and enter the Amazon information in the dialog box that appears, or paste in the code in the separate tab. Click the Insert button, and a bar appears in the post.

The result is a placeholder box that indicates that the item will appear here in the post when viewed as an actual page. By default, the item will appear flush left, but can be changed by clicking inside the shortcode box (in the text) and choosing a different alignment option.

What About Product Previews?

If the pop-up product previews are desired, Amazon provides a code to add that function. This code needs to be placed in a template file, not in a post.

Place this code after the content and before the </body> tag, per Amazon’s instructions. Use a text editor to edit the footer.php template, placing the Amazon paste-in script above the </body> tag on that file.

The reason for placing it in the footer tag is so that no matter what type of page WordPress calls up, the footer is always used and guarantees the presence of this script in a page.

Using Amazon Codes in Sidebars

If items are to appear in sidebars, the use of WordPress widgets won’t require the use of the Amazon Widget Shortcodes plug-in.

In the Widgets panel on the Dashboard, add a new Text widget and paste the Amazon codes directly in the text field. A title is optional. Save the widget and update the changes. The items will appear on all pages with the sidebar.


The copyright of the article How To Add Amazon Products In A WordPress Blog in Blogs is owned by David Borrink. Permission to republish How To Add Amazon Products In A WordPress Blog in print or online must be granted by the author in writing.


Amazon Widget Shortcodes - WordPress (highlighted), David Borrink
Amazon logo in WordPress Editor, David Borrink
     


Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo

Comments
Jan 12, 2009 9:06 PM
Guest :
Does this work if you're not using Wordpress 2.0 at wordpress.org? Does it work on the free blogs at wordpress.com?
Suzanne
Jan 13, 2009 3:43 AM
David Borrink :
Suzanne,

The free blogs at WordPress.com are set up with the condtion that no advertising is alowed, so obviously that means this won't work with those.

This article provides the solution for WordPress.org blogs since they operate a certain way. Amazon affiiate programs can be used with most blogging programs such as TypePad, and others, as well. How their coding structure interacts with add-on scripts depends on the way their programs are coded.

Hope that helps.
David
2 Comments