Skip Popover and Go To Custom URL Field

This article will show you how to skip the event popover and send your visitor to a custom URL field. You can configure this field to send users to another URL on your site instead, or to an external URL.

Add the snippet below to your themes functions.php file.

Replace 'custom_url' with the field name (if you're using ACF). If you're not using ACF, replace get_field() with get_post_meta() as needed. Make sure it returns null if not set.

add_filter('piecal_event_array_filter', function($event) {
    $event['customLink'] = get_field('custom_url') ?? null;
    return $event;
});

add_action('piecal_additional_event_click_js', function() {
    ?>
   	Alpine.store('calendarEngine').customLink = info.event._def.extendedProps.customLink;
    <?php
});

add_filter('piecal_popover_link_url', function() {
    ?>
    Alpine.store('calendarEngine').customLink ?? Alpine.store('calendarEngine').eventUrl
    <?php
});

Note: This snippet is designed to work with Advanced Custom Fields. Modifying this snippet is outside the scope of normal support.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.