Category shortcode not working correctly
-
I can’t seem to get the category event search attribute working. Here is an SSCCE demonstrating the problem:
I added categories to my events by adding an action in my theme to register taxonomies:
register_taxonomy_for_object_type('category', EM_POST_TYPE_EVENT); register_taxonomy_for_object_type('category', EM_POST_TYPE_LOCATION); register_taxonomy_for_object_type('category', 'event-recurring');
That worked great. Now I can add categories to my events as if they are posts.
Next I created a category called Test Category. It has taxonomy ID 62 and slug ‘test-category’.
Then I created an upcoming event called Test Event. I set the time to next week, and assigned it to Test Category. I can see that this worked in my Categories interface (Test Category now has a count of 1). I can also see it is working in the event itself. Test Category appears ticked when I edit the event.
Next I created a new post and put this shortcode in it:
[events_list category="test-category"]
But the post gets the output: ‘There are no events planned at the moment.’
Perhaps there is something wrong with the slug. I changed it to the category ID:
[events_list category="62"]
I’m still getting the same message.
I can’t figure out what’s wrong. Could you advise how I can get this shortcode working? It’s documented on the website here: https://wp-events-plugin.com/documentation/shortcodes/ and here https://wp-events-plugin.com/documentation/event-search-attributes/.
Thanks in advance for your advice!
(I posted this on Facebook initially, but the automated response directed me here.)
- The topic ‘Category shortcode not working correctly’ is closed to new replies.