Advanced title and Content fields
Adding custom fields, taxonomy terms, WooCommerce add to cart, star rating, price to the results.
Last updated
Adding custom fields, taxonomy terms, WooCommerce add to cart, star rating, price to the results.
Last updated
Advanced title and content fields editor is used to add various fields, such as custom field values, taxonomy terms list, WooCommerce Add To cart, Price, Star rating and many different result fields.
The advanced field editors can be found under the Advanced Options -> Content & Fields
panel.
Most of these use cases are explained in detail in the video above. For special cases not covered in the video, please read below.
The square brackets aka [
and ]
represent a conditional wrapper. Whatever is wrapped within these brackets is considered conditional, meaning:
If any of the field values is empty, everything within the conditional is returned as empty
You can use any number of fields in the conditionals
You can use any text or HTML within the conditionals
Say you have a field name "text_field", which may not be assigned to all of the results. You want to display the field value such as:
My field: {field value here}
The issue is, that when a result has no "text_field", the following text will be displayed:
My field:
By using conditionals, you can wrap the field and the preceeding text with the conditional, to avoid printing the "My field:" text when the "text_field" is empty.
Because the square brackets are used for conditional brackets, using shortcodes is possible via double square brackets.
To use a shortcode [my_shortcode]
in the field, the brackets have to be doubled so it becomes [[my_shortcode]]
Shortcodes should not be used within conditional brackets. The shortcode contents are executed after the conditional brackets are evaluated, therefore they don't have any effect on the conditionals.