Partagez cet article

At WordHerd we migrate a large volume of websites on a regular basis and in doing so, we often come across the need for an Events Calendar. We’ve used many over the years, but have really settled on Events Manager for WordPress because, unlike others we’ve tried, it is very reliable and never lets us down.

In a recent project we came across a unique scenario that we didn’t think the Events Manager was going to be able to handle, but lo and behold, it came through. The Events Listing page on this particular site separated the recurring events separate from the non-recurring events. The challenge was to fulfill this requirement while maintaining the filtering and pagination.

The documentation offers a lot of great resources, but the filters and hooks are left to the user to discover in the Events Manager for WordPress API repo. After some digging we were able to filter the sql conditions and ensure no recurring events were included in the final results.

add_filter('em_events_build_sql_conditions','em_events_filter_recurrences',1,2);
function em_events_filter_recurrences($sql, $args) {
  $sql['recurrence'] = '(`recurrence` IS NULL)';
  $sql['recurring'] = '(`recurrence_id` IS NULL)';
  return $sql;
}

In the end, the resulting code was quite easy to write and leaves our development team desiring more event calendars in future migrations!

Prêt à migrer votre site web ?

Commencez par une évaluation gratuite et sans engagement de votre site web. Nous examinerons votre projet, recommandons une plateforme de destination et vous fournirons un devis clair.

Garantie de perte de données nulle
Conservation complète des référencements et mappage des redirections
Livraison dans les délais et dans les limites budgétaires
Des spécialistes dédiés de la plateforme, et non des généralistes

Parlez-nous de votre site web

"*" indique des champs requis

Ce champ est destiné à des fins de validation et doit rester inchangé.
Nom*