Not tested, but give it a shot:
function my_em_force_ssl() {
if ( ! is_ssl() && em_is_event_page() ) {
wp_redirect( str_replace( 'http:', 'https:', get_permalink() ) );
exit;
} elseif ( is_ssl() && ! em_is_event_page() && $_SERVER['REQUEST_METHOD'] === 'GET' ) {
wp_redirect(
str_replace( 'https:', 'http:',
add_query_arg(
$_GET, site_url( $GLOBALS['wp']->request )
)
)
);
exit;
}
}
add_action( 'template_redirect', 'my_em_force_ssl', 10 );
And a heads up, template_redirect
is an action, so no need to accept & pass back params 🙂