Archive templates for Venues and Organizes

Home Forums Calendar Products Events Calendar PRO Archive templates for Venues and Organizes

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #992549
    media325
    Participant

    By adding the code below to my theme function file I was able to allow archives for venues and organizers.

    However the archive-tribe_organizer.php and archive-tribe_venue.php template pages aren’t being called. The archives continue to load the index.php page. Have I missed something?

      //re-register tribe_organizer to allow for archive pages
    function update_tribe_organizer_post_type() {
        register_post_type('tribe_organizer',
            array(
                'labels' => array (
                ),
                'public' => true,
                'has_archive' => true,
                'rewrite' => array(
                    'slug' => 'organizers',
                    'with_front' => false,
                ),
                'supports' => array(
                    'title',
                )
            )
        );
    }
    add_action( 'init', 'update_tribe_organizer_post_type');
         
      //re-register tribe_venue to allow for archive pages
    function update_tribe_venue_post_type() {
        register_post_type('tribe_venue',
            array(
                'labels' => array (
                ),
                'public' => true,
                'has_archive' => true,
                'rewrite' => array(
                    'slug' => 'venues',
                    'with_front' => false,
                ),
                'supports' => array(
                    'title',
                )
            )
        );
    }
    add_action( 'init', 'update_tribe_venue_post_type');
    #992802
    Geoff
    Member

    Hey @media325! Nice to see you again and hope all is well. 🙂

    Good question. Your functions are totally legit and on point. The issue is that our own template selector class Tribe__Events__Templates::templateChooser() intentionally overrides has_archive in order to allow the selection of a specific template in other views.

    This is completely untested, but you could try doing something like this to achieve the same effect:

    add_filter( 'template_include', 'custom_venue_template', 20 );
    
    function custom_venue_template( $template ) {
    if ( ! is_singular() || ! tribe_is_venue() ) return $template;
    return 'custom/template/path.php';
    }

    Like I said, it hasn’t been tried out, but should at least give you a good framework to start with.

    Let me know if you have any other follow-up questions here and I’d be happy to help as best I can. 🙂

    Cheers!
    Geoff

    #993168
    media325
    Participant

    Geoff
    Thank you. Can you expand upon

    intentionally overrides has_archive in order to allow the selection of a specific template in other views.

    I don’t want to interfere with core features or effect the Modern Tribe Plugins. Thanks

    #993198
    Geoff
    Member

    Good question! We specifically declare a different template for events and organizers than what would be used in the traditional WordPress hierarchy. Using the sort of structure in the snippet I provided would only have an impact on the Venue views and wouldn’t interfere with any of the plugin’s other functionality–you should be safe as far as that goes. 🙂

    Cheers!
    Geoff

    #997191
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Archive templates for Venues and Organizes’ is closed to new replies.