Hey, Where did the Code Go?
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.