Home › Forums › Calendar Products › Events Calendar PRO › Add Custom Category to Venues, cagtegory added, then ?
- This topic has 11 replies, 2 voices, and was last updated 8 years, 6 months ago by Josh.
-
AuthorPosts
-
August 28, 2015 at 10:54 am #999997FrancoParticipant
The function as on
https://theeventscalendar.com/support/forums/topic/add-custom-category-to-venues/
looks working fine on the admin side, I can add category for my venues, now my question (as the thread above were closed without further explanation) is:
How do I call a list of venues in a specific category in a template file? (such as for example: i want to display a page listing all venues in the category “Restaurant”, I can use a specific template for each category or use conditional as “if tribe_venue_category” or something like that, anyway, would be nice have this working)
Thanks ahead for help, this tricky stuff would be great if working on my Website too.
Franco
August 28, 2015 at 11:00 pm #1000164JoshParticipantHey Franco,
Thanks for reaching out to us!
You can do a general “WP_Query” of the “tribe_venue” post type. You can also do a “tax_query” on that same query and target the new category that you’ve created as well as the terms you would like to target.
Let me know if this helps.
Thanks!
August 29, 2015 at 2:10 pm #1000235FrancoParticipantThis reply is private.
August 30, 2015 at 1:21 pm #1000318FrancoParticipantHello again Josh,
thanks again for your suggestions, I did try to get it working but nothing to do, I get my venues categorized but I still looking on how get them displayed (as regular WP categorized posts) in a template loop.
Any help (source code example) would be nice.
Cheers,
FrancoAugust 31, 2015 at 8:50 pm #1000770JoshParticipantHey Franco,
To start, it sounds like you’ve tried adding the generateWP.com code to your site however that’s not working? Could you clarify a little bit on that point, is the code not creating the new taxonomy for Venues that you would like to see and assign on the backend of your site?
Thanks!
September 1, 2015 at 5:04 am #1000827FrancoParticipantHey Josh,
i get this code below in my function’s theme file and get my categories for venues on the backend, my question is how to display Venues within a Category (like displaying regular Category post in WP) on the frontend?
I try some code but nothing showing up, I am looking for a sample php code to display my venues in a specific category such as a category page with all venues in the category “Restaurants”, how should I do this in a template ?
Many thanks!
function venue_category() { register_taxonomy('tribe_venue_category', 'tribe_venue', array( 'hierarchical' => true, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'labels' => array( 'singular_name' => _x( 'Venue Category', 'venue singular name' ), 'menu_name' => __('Venue Categories', 'venue singular name') ), 'rewrite' => array( 'slug' => 'venue-category' ) )); } add_action( 'init', 'venue_category', 0 );
September 1, 2015 at 5:08 am #1000828FrancoParticipantThis reply is private.
September 1, 2015 at 9:59 pm #1001112JoshParticipantHey Franco,
Thanks for following up and it sounds like you’ve gotten the GenerateWP code working great on your site!
I can help to get you pointed in the right direction for what you’re trying to accomplish, however I do want to set expectations that I can provide specific customizations for your site.
So, to grab the new taxonomy terms that you’re now able to add to venues,Themer’s Guide WordPress has a great built-in function called “wp_get_post_terms()“. You can follow our Themer’s Guide to copy the “single-venues.php” file into your theme and add your customization there.
Here is a quick snippet that you can add to the single-venues.php that would output the names of the taxonomies that you have assigned to the venues.
Let me know if this helps.
Thanks!
September 2, 2015 at 6:59 am #1001213FrancoParticipantHello Josh,
many thanks for your help, it works fine as it display the Category for the Venue on the single venue page, but maybe I was not clear enough in my request or my english is not academic (for sure), I wish to show a page that display all post for a category, on the backend I can see all post in the category “bars-et-discotheques” this way
/edit.php?post_type=tribe_venue&tribe_venue_category=bars-et-discotheques
my question is: how can I display on the frontend all Venues (a list of all Venues) in the category “bars-et-discotheques” ?
This is what I try to achieve and it would be sooooo nice to have it working 🙂
Mamy thanks for your time and support.
Franco
September 3, 2015 at 8:41 am #1001655JoshParticipantHey Franco,
That page should be generated by default with WordPress. If you go to your Dashboard and go to the Venue Categories and hover over the categories that you created there, you should see an option that says “view”. If you click that link, you’ll be taken to a front-end archive which should show all posts (venues) that have been assigned to that category.
Let me know if this helps.
Thanks!
September 3, 2015 at 9:35 am #1001686FrancoParticipantHello Josh,
thank you, I do not have any dashboard menu for Venue Categories (I can see the list of venues in a category in the backend as explained in my last post above).
Anyway, I did -guess and- found the url to have them on frontend such as domain.ltd/venue-category/bar-et-discotheques/
Now I will try to find out how to have them displayed the way I want (order, featured images…)
Perfect ! I think we could now mark this thread as resolved, many thanks for your support and help.
Have a nice day.
FrancoSeptember 4, 2015 at 5:42 am #1002047JoshParticipantHey Franco,
No problem! Happy to help.
I’ll go ahead and close this thread for now. If you have any further questions, please don’t hesitate to open a new thread.
Thanks!
-
AuthorPosts
- The topic ‘Add Custom Category to Venues, cagtegory added, then ?’ is closed to new replies.