The main shortcode is products. With this you can present the products in different display types, sortings, etc.
Code (Example 1)
[pastacode lang=”php” manual=”%26%23091%3Bproducts%20layout%3D%22grid%22%20limit%3D%2210%22%20orderby%3D%22rating%22%20order%3D%22asc%22%20manufacturer%3D%22canon%22%5D” message=”” highlight=”” provider=”manual”/]
Using this line of code, the shortcode would display 10 products in the grid-view. The products are sorted by their rating. The order would be ASC (ascending) and the output would only be effective for products, which are assigned to the taxonomy (manufacturer) CANON.
Keep in mind, that every taxonomy has a different name. So if you use “brand” instead of “manufacturer”, the last parameter have to be brand=”canon”.
Code (Beispiel 2)
[pastacode lang=”php” manual=”%26%23091%3Bproducts%20layout%3D%22list%22%20include%3D%22123%2C459%2C789%22%20orderby%3D%22date%22%5D%0A%0ALorem%20ipsum%20dolor%20…%0A%0A%26%23091%3Bproducts%20layout%3D%22list%22%20exclude%3D%22123%2C459%2C789%22%20orderby%3D%22date%22%5D” message=”” highlight=”” provider=”manual”/]
This example shows the true power of this shortcode. Initially the products will be displayed on two positions in the list-view and sorted by date. Special here are the attributes “include” and “exclude”.
With the first shortcode only products with the ID 123, 456 and 789 will be displayed on your page. These may be the “top three printers”.
After that you can give a little content and then integrate almost the same shortcode right below, but this time with the attribute “exclude”. This means that in this listing products with these IDs are not shown. In doing this you would have the top three products above, after that some content, and then the rest of the products. As a consequence you can minimize the „Ads Above Fold“ rather well. Of course you can mix and match, hence show the grid-view above and the list-view below.
Attribute
Name | Content | Default value | Default value |
limit | Number | 12 | Sets the limit on how many products should be displayed. For example for „the top 10 coffee machines”. Determines the number of products; expects a numeric value. |
orderby | ID, author, title, name, date, modified, rand, comment_count, menu_order, post__in, rating, rating_count, price | date | Sorting of the products. Sorting of the products. An extensive documention can be found in the WordPress Codex. In addition you can sort by rating. For this, use the value “rating”. |
order | various | DESC | Order of the sorting. Here you can specify how the sorting should take place: ascending or descending (for example for “the 10 most expensive coffee machines”) |
asc | Sorts the products by ascending (z => a // 1 => 999) | ||
desc | Sorts the products by descending. | ||
include | Number | – | IDs of products, which should be displayed, separated by comma Here you can specify one or more product IDs. The list is limited to this product/these products. Well suited for include=”1”, in order to only show 1 product, then put in a little text. After that you can… |
exclude | Number | – | IDs of products, which should not be displayed, separated by comma. …use the feature “exclude”, which works the other way round, in order to integrate the rest of the list. |
layout | div. | list | |
grid | Displays all products in a grid. 3 side by side. With smaller devices 2 or 1. | ||
list | Lists all products one below the other in individual rows. Also shows the „technical details “. | ||
table-x | Shows a comparison table (products below one another) | ||
table-y | Shows a comparison table (products side by side) | ||
detail_button | true, false | true | De-/activation of the „detail“-button |
buy_button | true, false | true | De-/activation of the “buy”-button |
details_fields | true, false | true | Show product details (on/off) – only applies for the “list”-layout |
details_tax | true, false | true | Show taxonomies (on/off) – only applies for the “list”-layout |
price_min | Number | – | Limits the display of products, that cost at least X |
price_max | Number | – | Limits the display of products, that cost at most X |
align | left, right, none | left | If you only present one product (e.g. limit=1), you can determine, which alignment it has to the text has. The “grid”-layout is a requirement for this feature. |
slider | true, false | false | Shows the products in a slider. The “grid”-layout is a requirement for this feature. |
interval | false, Zahl | 8000 | Rate of the slider in ms (milliseconds); use “false” to deactivate the automatic slide. |
col | Number | 3 | Which size of the grid should be loaded? Possible inputs: 3 (4 in a row), 4 (3 in row). Only functions in the grid-layout and/or with the product slider. |
rating | true, false | true | Product ratings (on/off). Only works in the table-layout (x, y) |
taxonomy | slug | – | The output (of products) can be filtered by the created taxonomies. Instead of „taxonomy“, the defined slug, e.g. “brand”, is specified. As value, the slug of the category is used. For example: brand=”canon”. In doing this, all products of the category Canon (wich is a term of the taxonomy brand) are shown. |
review | true, false | – | With this parameter, you can display the “Own Ratings” in a separate column for the table-layout (x/y) |
highlight | Number | – | IDs of products, which should be highlighted; separated by comma. Only works in the table-layout. |
shop | Number | – | If you want to show products from a special shop, use the ID of the shop as value. Multiple values are NOT possible. |
reduced | true, false | false | Use the value “true”, if you only want to show products with an old price (e.g. RRP, recommended retail price). |
price_compare | true, false | false | >Use the value “true”, if you want to show the price comparison in the table-x layout. |
War dieser Artikel hilfreich?
Keine Kommentare vorhanden