I am trying to use this function, but whenever I use it returns the word “Array” I assume thats because I have two terms within for each event. Is there a way to do this? Here is the example:
I have one event with two categories 8th Grade and Math. I want to have an icon returned by adding the category slug to a div as a class. So I want:
The following will output all category slugs assigned to specific event separated by a space (when wrapped in php tags).
`implode(‘ ‘,tribe_get_event_cat_slugs()); `
So, if your slugs were “8th-grade” and “math” then you could do:
<div class=”<?php implode(‘ ‘,tribe_get_event_cat_slugs()); ?>” >
Hi Anthony, it does indeed return an array, so you could either iterate across that array and do what you like with each individual term slug, or else cause it to implode() into a single string.
Thanks Snorton (we must have posted in quick succession 🙂 ) … just a note for both that it’s generally best to share code via a service like Pastebin or Gist, rather than share it directly in the forum – for instance I think you may have tried to share code in your initial post, Anthony, but it was, unfortunately, stripped out.