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_idint [Post iD] defaults to Current Post ID
  • field_slugstring [Custom Toolset Field Slug]
  • typestring [either empty, or img or a currently]
  • ahreftypestring [empty, or any valid HTML link type like tel or mailto] Only used if type is a
  • ahrefanchorstring [a href link anchor text] If empty will use field value.
  • prestring [any valid HTML prefix wrapping output of field]
  • afterstring [any valid HTML after wrapping output of field]
  • separatorstring [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"]