Add Custom Category to Venues, cagtegory added, then ?

Home Forums Calendar Products Events Calendar PRO Add Custom Category to Venues, cagtegory added, then ?

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #999997
    Franco
    Participant

    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

    #1000164
    Josh
    Participant

    Hey 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!

    #1000235
    Franco
    Participant

    This reply is private.

    #1000318
    Franco
    Participant

    Hello 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,
    Franco

    #1000770
    Josh
    Participant

    Hey 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!

    #1000827
    Franco
    Participant

    Hey 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 );
    #1000828
    Franco
    Participant

    This reply is private.

    #1001112
    Josh
    Participant

    Hey 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!

    https://gist.github.com/BeardedGinger/1dbc85046c3e4468b543

    #1001213
    Franco
    Participant

    Hello 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

    #1001655
    Josh
    Participant

    Hey 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!

    #1001686
    Franco
    Participant

    Hello 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.
    Franco

    #1002047
    Josh
    Participant

    Hey 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!

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Add Custom Category to Venues, cagtegory added, then ?’ is closed to new replies.