Hi Toolset,
I have a repeating field and it outputs in plain text when i use: <?php echo types_render_field("responsibilities"); ?>
I would like to have it more like this:
<ul class="list-unstyled mb-7">
<li class="py-3">
<div class="media">
<span class="btn btn-xs btn-icon btn-soft-success rounded-circle mr-3">
<span class="fas fa-arrow-right btn-icon__inner"></span>
</span>
<div class="media-body text-secondary">
Work with our leadership team to drive strategic planning and prioritization
</div>
</div>
Is this possible?
Thanks,
Menno
Hi Menno,
As discussed in the chat, here is an example of using the "separator" attribute, for showing some HTML wrapped around a repeating field.
Suppose, you want to show the output like this:
<ul class="list-unstyled mb-7">
<li class="py-3">Responsibility 1</li>
<li class="py-3">Responsibility 2</li>
<li class="py-3">Responsibility 3</li>
</ul>
In this case, we can split the output into 3 parts:
1. The "Before" part:
$before = '<ul class="list-unstyled mb-7"><li class="py-3">';
2. The "Separator " part:
$separator = '</li><li class="py-3">';
3. The "After" part:
To print the final output, these parts can be used with the field's function as:
echo $before.types_render_field("responsibilities", array( "separator" => $separator )).$after;
I hope this helps and please let me know if you need any further assistance around this.
For more personalized assistance around custom code, you can consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
regards,
Waqar