# Dashboard Widget: Events in the Next Two Weeks

> Adds a dashboard widget listing the events coming up in the next 14 days with dates and quick edit links, so the team always knows what is on.

- Type: PHP
- Runs: Admin only
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: events-calendar, dashboard, events
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/tec-upcoming-events-dashboard-widget/

## Code

```php
$wpide_days = 14; // Days ahead to show.

add_action( 'wp_dashboard_setup', function () use ( $wpide_days ) {
    if ( ! function_exists( 'tribe_get_events' ) || ! current_user_can( 'edit_posts' ) ) {
        return;
    }

    wp_add_dashboard_widget( 'wpide_tec_next', __( 'Coming up' ), function () use ( $wpide_days ) {
        $events = tribe_get_events( array(
            'start_date'     => 'now',
            'end_date'       => wp_date( 'Y-m-d 23:59:59', time() + $wpide_days * DAY_IN_SECONDS ),
            'posts_per_page' => 15,
        ) );

        if ( ! $events ) {
            echo '<p>' . esc_html__( 'Nothing scheduled.' ) . '</p>';
            return;
        }

        echo '<ul>';
        foreach ( $events as $event ) {
            printf(
                '<li><strong>%1$s</strong> &ndash; <a href="%2$s">%3$s</a></li>',
                esc_html( tribe_get_start_date( $event, true, 'D j M, H:i' ) ),
                esc_url( (string) get_edit_post_link( $event->ID ) ),
                esc_html( get_the_title( $event ) )
            );
        }
        echo '</ul>';
    } );
} );
```

## Notes

Change $wpide_days to look further ahead.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Dashboard Widget: Events in the Next Two Weeks" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
