Posted: October 22, 2014 at 4:59 am
|
Hi Guys, I’m thinking to create a list of events that is related to my post event. i actually try to dump the post (var_dump($post)) in order to see all useful infos but still i cant see the category/categoryname that i’ve inserted on the registered events. Id like to know if theres a way to filter all event that is related to the event in wp_query? is this possible? please help thanks. i would appreciate if you could get back to me as soonest. <?php if (have_posts()) : while (have_posts()) : the_post(); the_content(); endwhile; endif; ?> |
Hi Ferdie, I can suggest taking a look at the espresso_event_categories() template tag located in public/template_tags.php. It returns the event categories for the event. One suggestion on the query: In this case it may be best to not use the $wp_query global here. Instead use something like this:
As an aside, it turns out that WordPress gives you category archives automatically. If you go to {yoursite.com}/event-category/{name-of-category-slug} you’ll see a list of events in one category. You can even add these views to you site’s navigation using the built in WordPress menu manager. |
|
|
Hi Josh, Thank you for your reply btw i do really appreciate it, one thing is i could not find the espresso_event_categories() template or the public/template_tags.php in event espresso 4, also the $event_tax_query = new EE_Event_List_Query( $atts ); can i use some loop here? and display the list of the event that is related to one category? i really need to fetch the category of one event, to display the some related events for the event. |
|
Hi, The espresso_event_categories function is in the template_tags.php file which is located at /wp-content/plugins/event-espresso-core-reg/public/template_tags.php You can use that code to display events from a single category, here’s a version of the query that’s more fleshed out https://gist.github.com/joshfeck/e3c9540cd4ccc734e755 |
|
Hello Dean, Sorry it was my fault, i was looking at the previous version, yes i have seen the file already template_tags.php and its already working, but it include a tags like . is there a way to cut or disable the link, and get only the values of the category? Thank you for your prompt reply, i really appreciate it. |
|
Hi, Sorry the code you linked didn’t come through, can you add it to a pastebin? pastebin.com |
|
Hello, oh sorry.. actually i have been fetched already the category using espresso_event_categories().. my only problem is the functions returns with a link tag, and i only need the string value, is it possible to strip the values that return in order to get the string and exclude the link tag. $text = espresso_event_categories(); i try using this code but its no use at all. Thank you again. |
|
Hi Dean and Josh, I still have 2 issues but ill have tp open a new threads for this 😉 i really really appreciate your effort guys for paying attention. thank you very much! case closed! |
The support post ‘How to fetch the category of the event?’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.