How can I display only future events on the events listing page

Hello everyone !
I am currently creating a collaborative platform that will have multiple sections: a directory section, a sales section (so I plan to purchase the Marketplace extension), and an events section. My question concerns the events section: how can I display only future events on the events listing page and how can I display them based on the ‘date’ attribute I created? I would really like to use Hivepress for this, but if it lacks these essential features for event management, I’m afraid it may not be suitable… Thank you for your help

Hi,

This is possible, but it will require customization.

If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources, or consider hiring someone for custom work https://fvrr.co/32e7LvY

Alternatively, you can send your proposal via this link, and we will estimate the implementation Request a Quote

Thank you for your reply.
I will simplify my need. I just want to change the default sort order for some specifics categories. I have almost done it, here’s the code i have added in includes/components/class-attribute.php :

if (in_array($category_id, [27, 21])) {
			if ($attribute_name === 'dateeve') {
    // Modifier l'ordre du tri par défaut ici
	// Supprimez l'option de tri par date existante
// Supprimez l'option de tri par dateeve existante
unset($form_args['fields']['_sort']['options']['dateeve__asc']);
unset($form_args['fields']['_sort']['options']['dateeve__desc']);

// Ajoutez l'option de tri par dateeve en haut de la liste
$form_args['fields']['_sort']['options'] = ['dateeve__asc' => 'Dateeve ↑'] + $form_args['fields']['_sort']['options'];
}
}

But i need now to locate the function responsible for retrieving and displaying the ads on the page. Within this function, i will look for the code that performs the query to retrieve the ads. then i could add some more code

Can you tell me which file i should look into ? Thank you…

Thank you for waiting. Please make sure that you have enabled Display as a sorting option setting for your custom attribute. The attribute will appear in the listing sorting form. Then you can adjust the WP query sorting via this action pre_get_posts | Hook | WordPress Developer Resources You can check if it’s the main listings query and change the “orderby” accordingly.

Please use the Code Snippets plugin to add and manage custom PHP code snippets Code Snippets – WordPress plugin | WordPress.org

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