Home › Forums › Calendar Products › Events Calendar PRO › tribe_get_event_cat_slugs displays "Array"
- This topic has 7 replies, 4 voices, and was last updated 8 years, 10 months ago by Support Droid.
-
AuthorPosts
-
December 11, 2013 at 5:30 pm #81340Anthony D’ArcoParticipant
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:
Make sense?
Thank you,
AnthonyDecember 12, 2013 at 10:31 am #81440snortonParticipantThe 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()); ?>” >December 12, 2013 at 10:33 am #81441snortonParticipantrather that would be:
<div class=”<?php echo implode(‘ ‘,tribe_get_event_cat_slugs()); ?>”>December 12, 2013 at 10:33 am #81442BarryMemberHi 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.
Does that help?
December 12, 2013 at 10:35 am #81443BarryMemberThanks 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.
December 13, 2013 at 5:27 am #81551Anthony D’ArcoParticipantThis worked perfect! Thank you!
December 13, 2013 at 6:19 am #81572BarryMemberExcellent, thanks Anthony (and thanks for helping out Snorton) 🙂
July 7, 2015 at 6:30 am #982610Support DroidKeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘tribe_get_event_cat_slugs displays "Array"’ is closed to new replies.