If you’d like to reorder the subscription options that appear in the Subscribe dropdown on your calendar (for example, showing iCal first instead of Google Calendar), you can do this with a simple snippet.

Why You Might Want This

By default, the calendar sets its own order for subscription options. Some sites may prefer to highlight a specific platform (like iCal) for their audience. With a filter, you can easily adjust which option appears first.

The Snippet

Add the following code to your site. You can place it in your theme’s functions.php file via Appearance → Theme File Editor, or for a safer option, use the Code Snippets plugin.

/**
 * Reorder the subscribe links to place iCal first.
 *
 * @param array $subscribe_links An array of subscribe/export link objects.
 * @return array The reordered array of subscribe/export link objects.
 */
function my_custom_reorder_subscribe_links( array $subscribe_links ): array {
    $target= null;

    // Check if the 'ical' item exists and remove it from its current position.
    if ( isset( $subscribe_links['ical'] ) ) {
        $target= $subscribe_links['ical'];
        unset( $subscribe_links['ical'] );
    }

    // If the 'ical' item was found, add it to the beginning of the array.
    if ( null !== $target) {
        $subscribe_links = [ 'ical' => $target] + $subscribe_links;
    }

    return $subscribe_links;
}
add_filter( 'tec_views_v2_subscribe_links', 'my_custom_reorder_subscribe_links', 10 );

This will move the iCal option to the top of the dropdown.

Customizing Other Options

If you’d like to move a different option to the top, simply replace 'ical' in the snippet with one of these keys:

  • gcal = Google Calendar
  • outlook-365 = Outlook 365
  • outlook-live = Outlook Live
  • ics = ICS
  • outlook-ics = Outlook ICS file

For example, if you want Google Calendar to appear first, replace every instance of ical with gcal.

Best Practices