Custom Single layout - display event filtered for current item

Hi!
I am creating a custom layout for ‘associated centres’. In each centre I would like to display the list of events of the centre displayed.
If I use the Looper provider: query builder tool, I display all the events. I cannot filter only for the events of the displayed centre.
I created the events with Modern Event Calendar, created the CPT Associated Centres and modified the layout to display the associated centres in the event. When you click on the associated centre you enter the Single Layout which I am trying to modify.
Do you have any suggestions on how to do this?
Thank you very much

Hello Luca,

Thanks for writing in!

In your custom layout for the “Associated Centres”, you will have to use Looper Provider Query String that queries the events that have a relationship to the current center. You will need to have a query argument like:



$query = array(
    'post_type'  => 'mec-events',
    'meta_key'   => 'centri_associati',
    'meta_value' => '{{dc:post:id}}',
    'meta_compare' => 'LIKE'
);

And if you follow this thread; Looper Query String: Featured Products - Support - Themeco Forum, you know how to get the query string which is based on the argument above will be:
post_type=mec-events&meta_key=centri_associati&meta_value={{dc:post:id}}&meta_compare=LIKE

Hope this makes sense.

1 Like

Hello, @ruenel,
Fantastic!
That’s perfect and works like a charm!
Thank you very much for your explanation and help.

Hi Luca,

Glad that we are able to help you.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.