//Make all links clickable add_filter('the_content', 'make_clickable'); //change so guests can't be added to tickets add_filter( 'tribe_tickets_get_ticket_max_purchase', function() { return 1; } ); // Display the alert banner safely function display_alert_banner() { // Skip if this is an Ajax request (e.g. Events Calendar views) if (defined('DOING_AJAX') && DOING_AJAX) return; // Only set cookie on the 'alerts' category page (optional) if (is_category('alerts')) { setcookie('no_cache_alerts', '1', time() + 3600, COOKIEPATH, COOKIE_DOMAIN); // 1 hour cookie } // Get latest alert post $alerts = get_posts(array( 'category_name' => 'alerts', 'numberposts' => 1, 'orderby' => 'date', 'order' => 'DESC' )); if (!empty($alerts)) { echo '
'; foreach ($alerts as $post) { setup_postdata($post); echo '
'; echo '' . esc_html(get_the_title($post)) . ': '; echo '' . esc_html(wp_strip_all_tags($post->post_content)) . ''; echo '
'; } wp_reset_postdata(); echo '
'; } } add_action('wp_body_open', 'display_alert_banner'); // Prevent caching only when on single alert post (avoid during Ajax) function no_cache_alert_banner($headers) { if (defined('DOING_AJAX') && DOING_AJAX) return $headers; if (is_single() && has_term('alerts', 'category')) { $headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'; } return $headers; } add_filter('wp_headers', 'no_cache_alert_banner'); // Add class to body tag when an alert is present function add_alert_body_class($classes) { $alerts = get_posts(array( 'category_name' => 'alerts', 'numberposts' => 1 )); if (!empty($alerts)) { $classes[] = 'alert-active'; } return $classes; } add_filter('body_class', 'add_alert_body_class'); Past Events from June 7, 2024 – June 4, 2024 › Main Calendar › – Wellington Girls' College
Generic filters