Open brybeecher opened 8 years ago
Related: (as I came across more troubles related to the filter_event_permalink
function). Getting the event permalinks from a page that is not an eventbrite-index template gives an incorrect URL. This seems to be due to filter_event_permalink
using the get_queried_object()
function, it assumes we are on an eventbrite-index template. My workaround was writing my own function based on the existing filter_event-Permalink
$pages = get_pages(array(
'meta_key' => '_wp_page_template',
'meta_value' => 'eventbrite-index.php',
));
$eb_index_page = $pages[0]; // any EB index page should be fine
Replacing get_queried_object()
with $eb_index_page
filter_event_permalink will filter all calls to
get_permalink
while the global $post is the event.Eg. I was iterating over a list of plain, non-event post objects within the
eventbrite-single.php
intending to output their permalinks, but calls such asget_permalink($my_post)
will always return the permalink for the current event.I tried to add $post as an arg to
filter_event_permalink
so it would only conditionally change the permalink but the arg never seemed to be populated.My work around was to just call
setup_postdata($my_post)
andwp_reset_postdata()
for every post object. Hope it saves someone some time.