Hello!
I’m currently using Pods to create CPTs and in one of my pods (Vendors), I have a repeater field that I’m trying to display with line breaks, instead of commas.
The setting that Pods provides doesn’t seem to work, no matter what I set to, including trying to make a custom delimiter.
Here are some things I’ve tried:
I’ve tried to create a pods template, which technically works; however, placing the shortcode in bricks displays the repeater field’s entries for every post under Vendors and not the specific one in the query loop.
[pods name="vendors" item="{pods_vendors_day_location}" template="Day Location"]
I know the issue lies in the item parameter, but I can’t figure out another way to have the shortcode explicitly display only its current query item.
I’ve attempted some PHP to find the commas and replace with
, though I’m not as savvy in that department.
Here is the code I’ve attempted:
// Instantiate Pods
$pods = pods( 'vendors', get_the_ID() );
// Retrieve your Pods field
$vendors_day_location = $pods->field( 'pods_vendors_day_location' );
if ( $vendors_day_location ) {
// Replace commas with <br>
$vendors_day_location = str_replace( ',', '<br>', $vendors_day_location );
// Output value
echo wp_kses_post( $vendors_day_location );
}
PHP is a hill I have to climb still, including how to debug effectively.
I’m not sure if I’m grabbing anything properly, especially since working with a query loop.
If anyone has any ideas I could try out, all help is much appreciated!
Debating if I should pull the trigger on ACF or Metabox after this!