Un shortcode est une forme abrégée de fragments de code plus longs. Les shortcodes, ou codes courts, sont programmés comme des fonctions et reçoivent un nom unique. Ces codes courts permettent d’intégrer des composants ou des processus à certains éléments d’un site Internet, sans nécessiter de grandes connaissances en programmation. La structure des shortcodes dans WordPress est ancrée dans le CMS : les codes sont entre crochets pour permettre, par exemple, d’intégrer une galerie à un endroit spécifique sur une page existante ou dans un article à l’aide du plugin WordPress
woo | Shortcode Name | Basic Shortcode | Description |
---|---|---|---|
Product list shortcodes | |||
Products | [products] | Lists products in a grid layout | |
Product table | [product_table] | Lists products in a table layout | |
Product category | [product_category category= »clothing »] | Lists products from a specific category | |
Product categories | [product_categories] | Lists the categories from your store | |
Recent products | [recent_products] | Lists recently added products | |
Featured products | [featured_products] | Lists featured products | |
Bestselling products | [best_selling_products] | Lists most popular products | |
Sale products | [sale_products] | Lists on-sale products | |
Top rated products | [top_rated_products] | Lists top rated products | |
Related products | [related_products] | Lists related products | |
Product attribute | [product_attribute attribute= »color » terms= »red »] | List products with a certain attribute | |
Product tags | [product_tags] | List product tags (or products by tag) | |
Bulk variations | [bulk_variations id= »123″] | Displays an order form of variations for a specific product | |
Product filters | [product_filters id= »1″] | Displays a group of filters on a product listing page | |
Displaying information about products | |||
Quick view | [quick_view id= »123″] | Displays quick view buttons for a product | |
Product page shortcode | [product_page id= »123″] | Inserts the content from a product page | |
Add to cart | [add_to_cart id= »123″] | Displays the add to cart button for a specific product | |
Product reviews | [product_reviews id= »123″] | Displays the reviews for a specific product | |
WooCommerce page shortcodes | |||
WooCommerce cart | [woocommerce_cart] | Displays the content of the cart page | |
WooCommerce checkout | [woocommerce_checkout] | Displays the content of the checkout page | |
WooCommerce order tracking | [woocommerce_order_tracking] | Displays the content of the cart page | |
WooCommerce my account | [woocommerce_my_account] | Displays the content of the cart page |
WooCommerce products shortcode
WooCommerce has a shortcode that lets you list specific products in a grid layout:
[products ids= »83,68,70,66,64,62″]
Product category shortcode
The Product category shortcode lists products from a specific category in a standard grid layout, for example:
[product_category category= »clothing » per_page= »12″ columns= »4″ orderby= »default » order= »asc » operator= »in »]
[product_table category= »clothing »]
WooCommerce product categories shortcode
The Product categories shortcodes lists your product categories, instead of the products within them. For example, [product_categories orderby= »name » order= »asc »] will list your WooCommerce categories, ordered by name.
Recent products shortcode
The WooCommerce Recent products shortcode displays the products you’ve recently added to your ecommerce store, for example:
[recent_products per_page= »8″ columns= »4″ orderby= »date » order= »asc »]