• Resolved Josh Habdas

    (@jhabdas)


    I’m attempting to output a JSON-based data structure in my Pods template using the [each] template tag. The expected data structure looks like this:

    ["item1", "item2", "item3"] (notice there is no trailing comma)

    Looking at template tag docs I don’t see a way to achieve this currently. Am I missing something obvious? Thanks for your help, Jim!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Scott Kingsley Clark

    (@sc0ttkclark)

    Don’t use a Pod template for that. Just use PHP with something like echo json_encode( $pod->field( 'my_field' ) ); where my_field is a relationship field. You can also traverse if it’s not a simple relationship, like my_field.ID to get all the post IDs

    Thread Starter Josh Habdas

    (@jhabdas)

    Thanks for your reply, @sc0ttkclark. Sounds good to me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘JSON-LD and Pods Templates’ is closed to new replies.