- This topic has 2 replies, 2 voices, and was last updated 13 years, 2 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘Generic’ is closed to new topics and replies.
Events Made Easy › Forums › Generic › Additional query only gets event data
Tagged: query, single event
I have a sidebar with a eme_get_events_list(“limit=8&scope=future&order=ASC”) call that is then followed by a get_posts($args) call that gets a specific category. It works fine (with every other type of page), until I navigate to a single event page, and than my get_posts($args) call returns the data from the event! Any idea why this would happen??
Further to this, I changed the query from get_posts to a new WP_query, and even within that query, if I print the_content() I get the content from the event!
so the query produces the correct title, correct day posted, the wrong content, and then the correct category. It calls multiple posts, with the same result. The “content” for each is the same – and it is the event content, not the post content, and the content is repeated for each post called by the query.
It would seem that this plugin messes with the function “the_content()” in some way, as I am calling it using $myNewQuery->the_content(), not simply the_content().
I may have a workaround using get_the_content() — but this whole thing is pretty weird, considering the query works fine on every other page!!
Ok, I neglected this bug a bit too long … sorry about that.
Concerning the_content: indeed I filter the_content, but it should only happen on the events page:
function eme_filter_events_page($data) {
// we change the content of the page only if we're "in the loop",
// otherwise this filter also gets applied if e.g. a widget calls
// the_content or the_excerpt to get the content of a page
if (in_the_loop() && eme_is_events_page()) {
return eme_events_page_content ();
} else {
return $data;
}
}
add_filter ( 'the_content', 'eme_filter_events_page' );
Concerning the single event_page and get_posts: there the same logic applies, but maybe the restriction I use is not enough?