{"id":2320,"date":"2026-01-21T11:11:29","date_gmt":"2026-01-21T12:11:29","guid":{"rendered":"http:\/\/gogetmuscle.com\/?p=2320"},"modified":"2026-01-21T17:44:02","modified_gmt":"2026-01-21T17:44:02","slug":"template-field-value-rendering-as-text-instead-of-applying-as-class-on-body-wrapper","status":"publish","type":"post","link":"http:\/\/gogetmuscle.com\/index.php\/2026\/01\/21\/template-field-value-rendering-as-text-instead-of-applying-as-class-on-body-wrapper\/","title":{"rendered":"Template field value rendering as text instead of applying as class on body wrapper"},"content":{"rendered":"

\u00a0<\/P>
\n

I am working in a base HTML template and trying to use a template choice field to dynamically add a CSS class to my body wrapper.<\/P>
\n

This is the field definition I am using:<\/P>
\n

\u00a0<\/P>
\n


\n

\n

\n
\u00a0<\/DIV>
\n<\/DIV>
\n<\/DIV>
\n
\u00a0<\/DIV>
\n<\/DIV>
\n

<\/P>
\n

{% choice “bg_color” label=”Select Header Background Color”, value=”header-default”, choices=”[[“header-blue”, “Blue”], [“header-white”, “White”], [“header-default”, “Default”]]”, export_to_template=true %}
<\/p>\n
<\/div>\n



<\/PRE>
\n

\u00a0<\/P>
\n

Instead of the class being added to the element, HubSpot is rendering the field value as visible text at the top of the page inside a span wrapper.<\/P>
\n

My goal is to use the selected value only as a class and not have it output any visible markup.<\/P>
\n

What is the correct way to reference a template choice field so it can be used purely as a class value without rendering text on the page?<\/P>
\n

Any guidance would be appreciated.<\/P>
\n

\"akshu_rana_0-1768997457323.png\"<\/span><\/P>
\n

\u00a0<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"

\u00a0 I am working in a base HTML template and trying to use a template choice field to dynamically add a CSS class to my body wrapper. This is the field definition I am using: \u00a0 \u00a0 \u00a0 {% choice “bg_color” label=”Select Header Background Color”, value=”header-default”, choices=”[[“header-blue”, “Blue”], [“header-white”, “White”], [“header-default”, “Default”]]”, export_to_template=true %} \u00a0 […]<\/p>\n","protected":false},"author":1,"featured_media":2322,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[],"_links":{"self":[{"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/posts\/2320"}],"collection":[{"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/comments?post=2320"}],"version-history":[{"count":2,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/posts\/2320\/revisions"}],"predecessor-version":[{"id":2323,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/posts\/2320\/revisions\/2323"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/media\/2322"}],"wp:attachment":[{"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/media?parent=2320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/categories?post=2320"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gogetmuscle.com\/index.php\/wp-json\/wp\/v2\/tags?post=2320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}