WordPress Amazon插件:Amazon Product In a Post Product Grid
Usage in the most basic form is the Shortcode and the keywords written as follows:
[amazon-product-search keywords="Deadpool Mask"]
There are additional parameters that can be added if you need to refine your search. They are listed below with a description of each:
keywords— this is keywords to use for the search — required.
search_title— using 1 will turn the keyword search into a title only search (more narrow search) — default is 0.
fields— the product fields to show for this product, comma separated. Default fields are:
search_index— the search index to use for the Amazon Search — default is ‘All’. Some options are:
NOTES: — When performing a title search, the search_index cannot be ‘All’ or ‘Blended’.
condition— The condition of the products to display — default is ‘New’. Available options:
sort— the sorting column to use for returned products — default is ‘titlerank’.
item_count— the number of products to display — default is 10 which is also the maximum.
item_page— the page of products in the search result to return — default is 1 (first page of results). Max page is 5 for ‘All’ or ‘Blended’ search index or 10 for everything else.
browse_node— use this to refine your search. Cannot be used when `search_index` is ‘All’ or ‘Blended’ — default is none.
page— alias for item_page.
template— used mostly for Gutenberg Block Layout. Default is ‘default’. Other option:
msg_instock— the in stock message can be overridden here — default is
msg_outofstock— the out of stock message can be overridden here — default is
Out of Stock
button— this is for the new HTML Buttons. can be any valid registered HTML Button — default is blank. Available core pluign buttons can be seen here.
use_cartURL— using ‘true’ will use the Cart URL link and ‘false’ will use the product page link — default is ‘false’ (product page link).
title_charlen— using a number greater than 0 will trim the title to that number of characters. Anything above 150 will show full title. default is 0 (show full title).
single_only— using 1 shows the product on a Single page/post only (not on archive or blogroll) and 0 shows it on single or list pages/posts — default is 0 (product will be shown on single or list pages).
image_count— this is the number of images to show for the Gallery. Only used when the
galleryparameter flag is set to 1 — default is -1 (show all). Other options are 1 to 10 – anything over 10 shows all.
is_block— this is a special parameter to tell if this is a Block element or a shortcode element. Used internally only. — default is 0 (0 for shortcode or 1 for block).
className— this is for the Gutenberg additional className attribute. You could also use it to pass an additional class name to the product wrapper. Comma or space seperate multiple class names.
target— the target name when open in a new window setting is active — default is
button_url— use this to set an image button. Add the full URL for the button — default is blank.
container— the HTML container wrapper element — default is
divDo not use < or >.
container_class— the class name for the outer wapper — default is
labels— the labels to use for selected fields. Use ‘:’ to sepatate field and label values.
locale— this is the Amazon locale you want to get the product from, i.e., com, co.uk, fr, etc. default is your plugin setting.
partner_id— allows you to add a different parent ID if different for other locale — default is ID in settings.
private_key— allows you to add different private key for locale if different — default is private key in settings.
public_key— allows you to add a different private key for locale if different — default is public key in settings.
Examples of it’s usage:
- Title Search with red Buy From button:
[amazon-product-search keywords="Deadpool Mask" title_search="1" button="buy-from-red-rounded"]
- Keyword Search with Grid Layout, blue Buy From button and price:
[amazon-product-search keywords="Deadpool Mask" template="grid" fields="image,title,price,button" button="buy-from-blue-rounded"]
Available Fields for the shortcode:
These are generally common in all products (if available)
title– Product Title.
description– Product Description.
new price– Product Price.
price+list– Shows both the Product list price and sale price.
image– Product Image (Medium Image).
sm-image– Product Small Image.
med-image– Product Medium Image.
lg-image– Product Large Image.
full-image– Product Full Image.
large-image-link– Large Image Link (shows “See Larger Image” link).
link– Product Page Link (shows full link in anchor tag).
imagesets– Product Additional Images.
features– Product Featured Items Text.
list– Product Manufacturer’s Suggested Retail Price (SRP).
new-button– No Longer Used.
button– Displays default Image button or HTML button if a button templte was passed as a shortcode parameter.
customerreviews– Product Customer Reviews (shown in an iframe only). Not ideal for Grid layout.
There are other fields available – bascially any field returned in the API can be used. For a more complete list, see amazon-elements shortcode page.