Home › Forums › Calendar Products › Events Calendar PRO › Custom page with events loop based on category.
- This topic has 7 replies, 3 voices, and was last updated 10 years, 10 months ago by
Josh.
-
AuthorPosts
-
May 12, 2015 at 12:46 pm #962184
victoria bell
ParticipantI am trying to create a custom page template for the main events page which will display the next 4 events for each of 6 event categories. What loop code do I use for each category?
I would also like to create a list view page for each of the 6 event categories. How do I do this?
Couldn’t find the solution in the forums. Thank you!
May 13, 2015 at 10:29 am #962368Josh
ParticipantHey Victoria,
Thanks for reaching out to us!
To start, you can query the events by using the tribe_get_events() function. You can pass the same arguments you would for a normal get_posts() or WP_Query to this function. That way, you can run multiple queries and within each target the specific categories that you would like.
To show list view archives of each of the categories you can take advantage of the default archives that are available for the event categories. You can find this by going to yourdomain.com/events/category/cat-slug and replacing the “cat-slug” with the slug for the category that you would like to view.
Let me know if this helps.
Thanks!
May 13, 2015 at 7:09 pm #962506victoria bell
ParticipantThanks Josh. I understand how to display the archive of categories as a page, but I’m still stuck on displaying a specific number of events based on category on a single page.
I essentially have 5 different categories (‘citywide’, ‘central’, ‘east’, ‘west’, ‘seasonal’) and I would like to display 4 events per category in a <div>.
I pasted my code here: http://pastebin.com/sNwt6cBt and really appreciate further direction. I know how to work with custom post types but I can’t seem to wrap my head around these events.
Thank you!
May 14, 2015 at 8:57 pm #962833Josh
ParticipantHey Victoria,
Here is a gist on how to set up the query for the events you would like to display https://gist.github.com/BeardedGinger/7886729d4a8db2360e40 (untested). This is the general direction and will also need to be filled out with the information and additional “foreach” loops that you can see in the examples here.
This would replace the entire “WP_Query()” that you have set up on the code that you’re currently using for the page.
Let me know if this helps.
Thanks!
May 15, 2015 at 9:37 am #962951victoria bell
ParticipantThis reply is private.
May 18, 2015 at 1:09 pm #963415Josh
ParticipantHey Victoria,
I apologize for the confusion. I’ve just updated the gist with a little more structure, showing exactly where to add the markup you would like in controlling the layout for the loop.
If you would like further assistance in getting the custom template set up, you can reach out to a recommended developer. If you send an email to support[at]theeventscalendar.com we’d be happy to supply a list of recommended developers.
Thanks!
June 18, 2015 at 4:17 am #970864Hassen
ParticipantThis reply is private.
June 19, 2015 at 10:27 am #971412Josh
ParticipantHey Victoria,
It’s been a while since we’ve heard from you. We’ll go ahead and close this thread and if you have any further questions, please don’t hesitate to open a new one.
Hassen,
If you would like some assistance in our forums, please don’t hesitate to open a new thread with your request.
Thanks!
-
AuthorPosts
- The topic ‘Custom page with events loop based on category.’ is closed to new replies.
