Site logo

Archived topic

Query loop suddenly only shows current events and not all events

15 replies · Started by Marcel on November 28, 2022

Viewing posts 1–15 of 16

We created a website of an artists collective and on every artist "page" we use a GBP query loop to show all the events (exhibitions) he/she worked with.

It all worked until a few weeks ago. Don't know if it was a GBP update or The Events Calendar but it used to show all events and now only current/future.

How to revert this into "show all events of tag"?

Hi Marcel,

Inherently, it should show all posts/events by default. Can you check if you have custom PHP snippets that could cause such filtering?

Hi Fernando, thanks for quick response. There are custom snippets but not related to filtering of events.

To be sure, can you try temporarily removing all PHP snippets added through Code Snippets or functions.php?

Let us know how it goes. It would be good to take a backup of your site before doing this.

just cleared all PHP snippets in functions.php, cleared cache and beside all lost effects the query loop didn't work

Hi there,

just so i am clear on the issue.

Before: the artist page would show ALL Events including any Events that had finished ?
After: the artist page only shows events that are currently available ?

Is that correct ?

Little bit more specific: BEFORE it showed ALL events by artist tag (past, current and future) and AFTER it shows only events by artist tag that are current or future

How is post defined as being past is it just the date ? Or is there a post term such as a category or tag ?

I guess because the event end date is before today, it’s not a setting in the query loop

Can you take a screenshot of the query loop settings?

Let me know!

see screenshot url in private area

That is rather odd, as you're not defining any query parameters to exclude past dates.
I had a search on the plugins docs and found they use the eventDisplay parameter in their queries.
And by setting it to 'eventDisplay' => 'custom' you can avoid there being any assumptions.

So try:

1. Add this PHP Snippet to your site:


add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) {
	// Check your logic to apply the filtering only to specific loop
	if (
		! empty( $attributes['className'] ) &&
		strpos( $attributes['className'], 'tec-query' ) !== false &&
		! is_admin()
	) {
		// Merge the current $query_args which contains arguments defined in the editor with your ordering arguments
		return array_merge( $query_args, array(
			'eventDisplay' => 'custom',
		) );
    }

    return $query_args;
}, 10, 2 );

2. Select the Grid Block found inside the Query Loop block, and in Advanced > Additional CSS Class(es) add: tec-query

Thanks David for you time and possible solutions! I tried your suggestion but it didn't work, see url

Hmmm.... do you use any functions that change the the event calendars behaviour ?

Hi David,

sorry for my late response I was on the road for 3 days.

Shall I give you access to the website?

There are extra TEC functions (translate strings) but I already deleted them to test after Fernando asked but that didn't worked either.

This archived topic is closed to new replies.