ShortCode
[tws_rep_field]
This ShortCode is part of the ToolWine ShortCodes Plugin. Download and Install the ToolWine ShortCodes Plugin to use it. Note that the Plugin requires Toolset Types and Views (or Blocks) installed and active.
The [tws_rep_field]
ShortCode can be used to display Toolset Repeating Fields by wrapping them in particular HTML output like a href
links or img
image tags. It is often impossible to do this with Toolset’s inbuilt “separator” attribute that they provide for repeating fields in the Toolset Fields ShortCode because a Link, or also Image tag, can and will have several attributes that we need to set for each instance and using the Separator argument gets messy and undoable altogether.
Attributes:
post_id
– int [Post iD] defaults to Current Post IDfield_slug
– string [Custom Toolset Field Slug]type
– string [either empty, orimg
ora
currently]ahreftype
– string [empty, or any valid HTML link type liketel
ormailto
] Only used iftype
isa
ahrefanchor
– string [a href
link anchor text] If empty will use field value.pre
– string [any valid HTML prefix wrapping output of field]after
– string [any valid HTML after wrapping output of field]separator
– string [any valid HTML to separate field values (with wrapping html)]
Example
//Display repeating Image Field with img tag [tws_rep_field field_slug="wpcf-rep-image" type="img" pre="<div class='item'>" after="</div>"] //Display repeating Phone Number field as a clickable link [tws_rep_field field_slug="wpcf-rep-phone" type="a" ahreftype="tel"]