{"id":1515938,"date":"2018-04-25T09:19:34","date_gmt":"2018-04-25T16:19:34","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/"},"modified":"2018-04-25T09:19:34","modified_gmt":"2018-04-25T16:19:34","slug":"add-venue-body-class","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/","title":{"rendered":"add venue body class"},"content":{"rendered":"<p>Hey there!<br \/>\nI want to add the venue nicename to my body class and change the background depending on the venue the event is listed for. The event overview body however needs to be untouched.<br \/>\nMy Problem: The venue classes are all added up to the body whenever the overview &#8220;events&#8221; is opened. So all bodys are being loaded. I found a solution, but im not sure if its really stable &#8211; Im not in to php to be honest.<\/p>\n<p>&#8216;add_filter(&#8216;body_class&#8217;,&#8217;conf_class&#8217;);<br \/>\nfunction conf_class($classes) {<\/p>\n<p>    $post_id = get_the_ID();<br \/>\n    $venue = tribe_get_venue($post_id); <\/p>\n<p>if (is_tax()){<br \/>\n\t$venue = &#8216;myVenue-&#8216; . $venue;<br \/>\n  $classes[] = $venue;<br \/>\n  return $classes;<br \/>\n} else {return $classes;}<br \/>\n}&#8217;<\/p>\n<p>My questions on this peace of code: <\/p>\n<p>&#8211; I added &#8220;is_tax()&#8221; because it ocures to me, that &#8220;events&#8221; page has no custom taxonomies &#8211; can I ask for specific taxonomies like string &#8220;category nicename&#8221; here? Would be better I guess. something like &#8220;if is_tax(&#8220;category name&#8221;).<\/p>\n<p>&#8211; In the end I had to return the untouched classes. If I dont return them, some classes go missing (like for closed tribe filter bar). Is that correct?<\/p>\n","protected":false},"template":"","class_list":["post-1515938","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>add venue body class -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"add venue body class -\" \/>\n<meta property=\"og:description\" content=\"Hey there! I want to add the venue nicename to my body class and change the background depending on the venue the event is listed for. The event overview body however needs to be untouched. My Problem: The venue classes are all added up to the body whenever the overview &#8220;events&#8221; is opened. So all [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/\",\"name\":\"add venue body class -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2018-04-25T16:19:34+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"add venue body class\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"add venue body class -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/","og_locale":"en_US","og_type":"article","og_title":"add venue body class -","og_description":"Hey there! I want to add the venue nicename to my body class and change the background depending on the venue the event is listed for. The event overview body however needs to be untouched. My Problem: The venue classes are all added up to the body whenever the overview &#8220;events&#8221; is opened. So all [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/","name":"add venue body class -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2018-04-25T16:19:34+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/add-venue-body-class\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"add venue body class"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1515938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1515938\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1515938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}