Query filter args with front-end rendering

Hello all,

I’m using the below on page without ‘front-end-rendering’ and that works perfectly.
The events get 1st sorted by ‘meta_value_event_date_start’, then by ‘meta_value_event_date_end’ and last by ‘meta_value_event_name’.

<?php
add_filter( 'cwicly/query/args', function( $query_args, $attributes, $id ) {
	if ($id === 'query-1234567') {
		$current_date = date( 'Ymd' );
		$query_args['meta_query'][0]['value'] = $current_date;


		$query_args['orderby'] = [
		'meta_value_event_date_start' => 'ASC',
		'meta_value_event_date_end' => 'ASC',
		'meta_value_event_name' => 'ASC'
		];


		$query_args['meta_query']['meta_value_event_date_start'] = [
		'key' => 'event_date_start',
		'orderby' => 'meta_value_num',
		'order' => 'ASC'
		];

		$query_args['meta_query']['meta_value_event_date_end'] = [
		'key' => 'event_date_end',
		'orderby' => 'meta_value_num',
		'order' => 'ASC'
		];


		$query_args['meta_query']['meta_value_event_name'] = [
		'key' => 'event_name',
		'orderby' => 'meta_value',
		'order' => 'ASC'
		];
	}
return $query_args;
}, 10, 3 );
?>

The parts where I need some insights is:
A: when I use this on a page with filters/fron-end rendering, the above mentioned orderby doesn’t get applied.

B: As in the above mentioned code, with he below code, the count numbers in the taxonomy filters wont show up anymore.

$current_date = date( 'Ymd' );
$query_args['meta_query'][0]['value'] = $current_date;

When I remove the above in the code and use a shortcode (see below) in the meta-query, the taxonomy count numbers will show.

function shortcode_today_date() 
    { return date('Ymd');}
add_shortcode('sc_date_today', 'shortcode_today_date');

@Louis, could you also have a look at this?

Thank you!

Long story short, pre args filter doesn’t work with front-end rendering.

@Araminta // @Louis,
Is there a solution available?

Hello @dennis77,

My apologies for the delay here, and thanks for your patience.
This should be addressed in the next Cwicly release.

I will update this post then.

Cheers,

Thank you @Louis! and congrats on the component element. Saw the YT live yesterday, looking :+1: :+1:

Hello @Louis,

Unfortunately, with the latest 1.3 update, the query args filter doesn’t work yet, with the front-end rendering.

FR turned off: all the dates are in the order as given in the filter query .
FR turned on: the filters aren’t applied and all the dates are in a random order.

Thank you,
Dennis

Hi,

I can confirm that filtering is registering properly for me with Frontend Rendering activated.

Would you be so kind as to try a simpler filtering example and report if that applies?

Best regards,
Johnny

Hello @JohnD,

The filtering works perfect without front-end rendering turned on. As soon as I turn it on, it doesn’t work.

Tested it with only one condition, sort on name, but also that doesn’t work.

It looks like that the “query args filter” doesn’t ‘reach’ the query-id with the front-end rendering turned on.

Hi,

As mentioned in my previous post, filtering the query args for Frontend Rendering should work as it is for me and was added in the last important update.

Would you be so kind as to confirm you have cleared all your cache (server/client)?

Best regards,
Johnny

Hello @JohnD,

Yes all cache(s) cleared.

I made a new page for testing purposes and applied a filter query arg just for sorting on the name, but that doesn’t work with front-end turned on.

Please do post your filter query args conditions, maybe I oversee something.

Hi,

I have sent you a PM with necessary details.

Kindly let me know once you have checked that out.

Best regards,
Johnny

Thank you JohnD,

Just answered you.