Home › Forums › Calendar Products › Events Calendar PRO › Return category name with post in loop
- This topic has 7 replies, 3 voices, and was last updated 11 years ago by
Support Droid.
-
AuthorPosts
-
February 8, 2013 at 11:58 am #32347
Chris
ParticipantI love this plugin. One thing I can’t figure out so far: I am getting my event data returned using global $post;
$all_events = tribe_get_events(
array(
‘eventDisplay’=>’upcoming’,
‘posts_per_page’=>10,
‘tax_query’=> array(
array(
‘taxonomy’ => ‘tribe_events_cat’,
‘field’ => ‘slug’,
‘terms’ => ‘microsoft-excel-classes’
)
)
)
);foreach($all_events as $post) {
setup_postdata($post);
etc. and it is working great. But I would like to grab my category name and output it in my WordPress page. I have tried get_the_category() and the_category to no avail. Any help?February 8, 2013 at 2:41 pm #32351Barry
MemberHi Chris, because our forum has a tendency to mangle code I’d like to be sure the code you posted above is accurate … so, can you paste a link to your code using a service like Pastebin or Gist? Thanks!
February 8, 2013 at 4:15 pm #32358Chris
ParticipantHi Barry
The link for pastebin is http://pastebin.com/2yK04ru2. The challenge I’m referring to in this ticket is on line 29 not working.
Thanks
ChrisFebruary 9, 2013 at 5:20 am #32370Barry
MemberAh, oh. So using the_category() function will return regular post categories, however The Events Calendar uses a custom taxonomy for this so you’ll need to use different functions to do what you want here.
There are a few ways you might approach this but take a look at get_the_taxonomies() first of all or else you could do something like:
$terms = get_the_term_list( get_the_ID(), $tribe_ecp->get_event_taxonomy() );February 9, 2013 at 5:21 am #32371Barry
Member* In my snippet above, you would need to populate $tribe_ecp first of all:
$tribe_ecp = TribeEvents::instance();February 11, 2013 at 6:11 am #32410Chris
ParticipantThanks Barry, that plugged my leak! I appreciate your help, especially on a weekend. You guys rock. You can close this ticket if you like.
February 11, 2013 at 6:20 am #32411Barry
MemberCheer Chris 😀
July 7, 2015 at 6:26 am #978585Support Droid
KeymasterThis 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 ‘Return category name with post in loop’ is closed to new replies.
