Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Don't allow anything earlier than this month to be displayed in the gridview
- if (isset($eventDate) and isset($eventDisplay) and $eventDisplay === 'month') {
- $thisMonth = date('Y-m').'-01';
- $redirectTo = get_site_url();
- // Is the user requesting something earlier than this month?
- if ($eventDate < $thisMonth) {
- // Redirect if possible
- if (!headers_sent()) {
- header("Location: $redirectTo");
- exit();
- }
- // If not possible to redirect, show an error message or 404
- else {
- get_template_part('404');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement