• Resolved Hans Schuijff

    (@hanswitteprins)


    Hi,

    I wanted to change some venues on past events using a filter. I was able to do so by hooking in the “tribe_get_venue_id” filter and change the venue id of the event.

    In the old layouts (before the v2-templates where used) both the list view and the single view now show the venue contact data of the filtered venue, exactly what I wanted. And also the json schema is changed the same way.

    Now I do the same after switching to the newer v2 templates and it doesn’t work anymore. The template gets the data from an event object, but this object isn’t affected by the venue filters.

    But the json data still is affected by the filter, so now, when I do the same in the event list view, the list presents the unfiltered venue to the visitor, while the json venue data is being filtered (so now contains the data I wanted).

    And this also constitutes a SEO problem, since now the content of the page conflicts with the json schema.

    Using the the “tribe_get_venue_id” filter hook, still works on the single page. Since it still works on most content I think this might be a bug. Is this a bug?

    And if not a bug, what other way to filter venues is there when using the v2 templates? There don’t seem to be new filters for the new templates and it would break customization otherwise.

    I wasn’t yet able to find where the venue is inserted in the event object and how to filter that, but it seems that the v2 (list-venue) templates no longer use the template tags and are no longer filterable as a result.

    So I wonder why it doesn’t work anymore and what is the proposed way of customizing venues in the v2 templates?

    Can you help?

    Regards,

    Hans

Viewing 1 replies (of 1 total)
  • Thread Starter Hans Schuijff

    (@hanswitteprins)

    As a quick fix I used a template override of /tribe/events/v2/list/event/venue.php to replace the venue object after it is filled in $venue.

    $venue                = $event->venues[0];
    
    // allow for venue to be filtered
    $venue_id             = tribe_get_venue_id( $event->ID );
    if ( $venue->ID != $venue_id ) {
    	$venue            = tribe_get_venue_object( $venue_id );
    }

    However I don’t like needing a template override for this reason, since then I have to override anywhere the venue filter hook is ignored and my website has become vulnerable to template changes.

    And i still need to use the hook too, so the json schema is updated.

    Thanks,
    Hans

Viewing 1 replies (of 1 total)
  • The topic ‘Venue filter hooks are ignored by the new v2 design list templates’ is closed to new replies.