WordPress Amazon插件:Amazon Product In a Post Elements Shortcode

WordPress Amazon插件:Amazon Product In a Post Elements Shortcode

[amazon-elements] Shortcode

shortcode implementation for elements only — for when you may only want specific element(s) like the title, price and image or image and description, or the title and the buy now button, etc.

  • asin — Required the Amazon ASIN (up to 10 comma sep).
  • fields — the product fields to show for this product, comma separated. Default fields are: image,title,button
  • labels — Labels that correspond to the fields (if you want custom labels). They should match the fields and be comma separated and :: separated for the field name and value i.e., field name::label text,field-two::value 2, etc. (optional)
  • use_carturl — using ‘true’ will use the Cart URL link and ‘false’ will use the product page link — default is ‘false’ (product page link).
  • 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.
  • button_url — URL for a button image, if you want to use a different image than the default one. ASIN Specific – separate the list of URLs with a comma to correspond with the ASIN. i.e., if you had 3 ASINs and wanted the first and third to have custom buttons, but the second to have the default button, use button_url="http://first.com/image1.jpg,,http://first.com/image1.jpg" (optional)
  • button_use_carturl — using ‘true’ will make the button use the Cart URL. setting use_carturl to true will make this true as well, unless you specifically set to false.
  • image_count — this is the number of images to show for the Gallery. Only used when the gallery parameter flag is set to 1 — default is -1 (show all). Other options are 1 to 10 – anything over 10 shows all.
  • msg_instock — the in stock message can be overridden here — default is In Stock
  • msg_outofstock — the out of stock message can be overridden here — default is Out of Stock
  • template — used mostly for Gutenberg Block Layout. Default is ‘default’. Other option: grid
  • container — the HTML container wrapper element — default is divDo not use < or >.
  • container_class — the class name for the outer wapper — default is amazon-element-wrapper.
  • 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.
  • 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).
  • target — the target name when open in a new window setting is active — default is _blank
  • newWindow — using 1 will open the product links in a new window — default is 0 (product open in the same window).
  • 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).
  • locale — the amazon locale, i.e., co.uk, es. This is handy of you need a product from a different locale than your default one. Applies to all ASINs in list. (optional)
  • partner_id — your amazon partner id. default is the one in the options. You can set a different one here if you have a different one for another locale or just want to split them up between multiple ids. Applies to all ASINs in list. (optional)
  • private_key — amazon private key. Default is one set in options. You can set a different one if needed for another locale. Applies to all ASINs in list. (optional)
  • public_key — amazon public key. Default is one set in options. You can set a different one if needed for another locale. Applies to all ASINs in list. (optional)

Example of usage:

  • if you want to have a product with only a large image, the title and button, you would use:
    [amazon-element asin="0753515032" fields="title,lg-image,large-image-link,button"]
  • If you want that same product to have the description, you would use:
    [amazon-element asin="0753515032" fields="title,lg-image,large-image-link,desc,button"]
  • If you want that same product to have the list price and the new price, you would use:
    [amazon-element asin="0753515032" fields="title,lg-image,large-image-link,desc,ListPrice,new-price,button" msg_instock="in Stock" msg_outofstock="no more left!"]
    The msg_instock and msg_outofstock are optional fields.
  • If you want to add some of your own text to a product, and makeit part of the post, you could do something like this:
    [amazon-element asin="0753515032" fields="title,lg-image,large-image-link" labels="large-image-link::click for larger image:,title-wrap::h2,title::Richard Branson: Business Stripped Bare"]Some normal content text here.[amazon-element asin="0753515032" fields="desc,gallery,ListPrice,new-price,LowestUsedPrice,button" labels="desc::Book Description:,ListPrice::SRP:,new-price::New From:,LowestUsedPrice::Used From:" msg_instock="Available"]

Available Fields for the shortcode:

Common Items

These are generally common in all products (if available)

  • asin – Product Identification Number.
  • URL – Product page URL on Amazon.
  • title – Product Title.
  • price or new-price – Product Sale Price.
  • SmallImage or sm-image – Product Small Image URL.
  • MediumImage or image or med-image – Product Medium Image URL.
  • LargeImage or lg-image – Product Large Image URL.
  • AddlImages or gallery- Product Additional Images.
  • feature – Product Featured Items Text.
  • Format – Product Format. I.e., DVD, Blu-ray, etc.
  • PartNumber – Product Part Number.
  • ProductGroup – Product Category. I.e., Books, Sproting Goods, etc.
  • ProductTypeName – Product Category Name. I.e., CAMERA_DIGITAL
  • ISBN – Product ISBN number.
  • ItemDesc or desc or description- Product Description.
  • ListPrice or list – Product Manufacturer’s Suggested Retail Price (SRP).
  • SKU – Product’s Unique Stock Keeping Unit (SKU).
  • UPC – Universal Product Code, which is a 12 digit number, 6 of which represents an item’s manufacturer. These numbers are translated into a bar code that is printed on an item or its packaging.
  • CustomerReviews – Product Customer Reviews (shown in an iframe only).

Offer/Pricing Elements

These are generally returned for most products.

  • LowestNewPrice
  • LowestUsedPrice
  • LowestRefurbishedPrice
  • LowestCollectiblePrice
  • MoreOffersUrl
  • NewAmazonPricing
  • TotalCollectible
  • TotalNew
  • TotalOffers
  • TotalRefurbished
  • TotalUsed

Items Attributes

Available only to their select product groups and not available in all locales. Try it first to see if it returns a value. For example, the Actor field is not going to be returned if the product is a computer or some form of electronics, but would be returned if the product was a DVD or Blu-ray Movie.

  • Actor
  • Artist
  • AspectRatio
  • AudienceRating
  • AudioFormat
  • Author
  • Binding
  • Brand
  • CatalogNumberList
  • Category
  • CEROAgeRating
  • ClothingSize
  • Color
  • Creator
  • Department
  • Director
  • EAN
  • EANList
  • Edition
  • EpisodeSequence
  • ESRBAgeRating
  • Genre
  • HardwarePlatform
  • HazardousMaterialType
  • IsAdultProduct
  • IsAutographed
  • IsEligibleForTradeIn
  • IsMemorabilia
  • IssuesPerYear
  • ItemDimensions
  • ItemPartNumber
  • Label
  • Languages
  • LegalDisclaimer
  • MagazineType
  • Manufacturer
  • ManufacturerMaximumAge
  • ManufacturerMinimumAge
  • ManufacturerPartsWarrantyDescription
  • MediaType
  • Model
  • ModelYear
  • MPN
  • NumberOfDiscs
  • NumberOfIssues
  • NumberOfItems
  • NumberOfPages
  • NumberOfTracks
  • OperatingSystem
  • PackageDimensions
  • PackageDimensionsWidth
  • PackageDimensionsHeight
  • PackageDimensionsLength
  • PackageDimensionsWeight
  • PackageQuantity
  • PictureFormat
  • Platform
  • ProductTypeSubcategory
  • PublicationDate
  • Publisher
  • RegionCode
  • ReleaseDate
  • RunningTime
  • SeikodoProductCode
  • ShoeSize
  • Size
  • Studio
  • SubscriptionLength
  • TrackSequence
  • TradeInValue
  • UPCList
  • Warranty
  • WEEETaxValue