SquatchCreative Posted June 13, 2023 Posted June 13, 2023 I have a custom collection: { "title" : "SHOWS", "ordering" : "user-orderable", "addText" : "Add Show Date", "acceptTypes": ["showsCustom"] } And I gave it the custom fields: { "title" : "Show Info", "name" : "showsCustom", "base" : "text", "fields" : [ { "name" : "tourdateMonth", "title" : "Month of Event", "type" : "text" }, { "name" : "tourdateDay", "title" : "Day of Event", "type" : "text" }, { "name" : "time1", "title" : "Time of Event", "type" : "text" }, { "name" : "time2", "title" : "Second Time (optional)", "type" : "text" }, { "name" : "ticketLink1", "title" : "Ticket Link", "type" : "text" }, { "name" : "ticketLink2", "title" : "Ticket Link 2 (optional)", "type" : "text" }, { "name" : "additional", "title" : "Additional Info (optional)", "type" : "wysiwyg" } ] } And when I output it on a custom template, everything works except for my `wysiwyg` field called "additional". Below is the code I am using: <squarespace:query collection="upcoming-shows"> <div class="row tour-show-row"> {.repeated section items} <div id="post-{id}" class="tour-show {@|item-classes}" data-item-id="{id}"> <date> <month>{customContent.tourdateMonth}</month> <day>{customContent.tourdateDay}</day> </date> <place> <location data-content-field="title">{title}</location> <venue> <a href="{customContent.ticketLink1}" target="_blank">@{location.addressTitle}</a> {.if customContent.additional} <span class="presale">{customContent.additional}</span> {.end} </venue> </place> <times> <a href="{customContent.ticketLink1}" target="_blank">{customContent.time1}</a> {.if customContent.time2} <a href="{customContent.ticketLink2}" target="_blank">{customContent.time2}</a> {.end} </times> </div> {.end} </div> </squarespace:query> The conditional statement fires, as I see empty <span class="presale"></span> so it is returning true... but nothing is output. Can anyone guess as to why? Using the docs for reference -- https://developers.squarespace.com/custom-post-types -- and all seems correct. Thanks!
Solution SquatchCreative Posted June 13, 2023 Author Solution Posted June 13, 2023 Aaaaaand I figured it out. The 'wysiwyg' field returns an object, so to call it, it requires: {customContent.additional.html} Which I discovered because the docs mention that you can append ?format=json-pretty to your URL and it will output all of the page's JSON for debugging, which was incredibly helpful. So your URL would be: http://www.mysite.com/my-list/?format=json-pretty Hope this helps someone! 👋
rafayama Posted August 24, 2023 Posted August 24, 2023 Thanks for your solution, it has fixed some of the problems I was having :)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment