WP Manifestindependent plugin directory
manifest / events / upcoming-calendar-events

Upcoming Calendar Events

Build a small WordPress plugin called "Upcoming Calendar Events" that displays upcoming events from a Google Calendar on the front-end of a WordPress site.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/varind3r/upcoming-calendar-events/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A lightweight WordPress plugin that displays upcoming events from a Google Calendar using a shortcode and AJAX rendering.

Features

  • Admin settings page under Settings -> Calendar Events
  • Google API key configuration
  • Cache duration and default event count settings
  • Shortcode [upcoming_events] with support for count, days_ahead, show_description, and google_calendar_id
  • Cache stored in WordPress transients and invalidated on settings save
  • AJAX-powered frontend rendering with graceful error handling

Installation

  1. Copy the upcoming-calendar-events folder into wp-content/plugins/.
  2. Run composer install from the plugin folder:
    cd wp-content/plugins/upcoming-calendar-events
    composer install
  3. Activate the plugin from the WordPress admin Plugins screen.

Setup

  1. Go to Settings -> Calendar Events in the WordPress admin.
  2. Enter your Google API key in the API key field.
  3. Set the cache duration in minutes (default is 60).
  4. Set the default number of events to display (default is 5).
  5. Click Save and validate to store the settings and verify the API key.

Usage

Add the shortcode to a page or post:

[upcoming_events count="10" days_ahead="30" show_description="true" google_calendar_id="something@group.calendar.google.com"]

Required shortcode attributes:

  • days_ahead - mandatory numeric number of days ahead to show events for
  • google_calendar_id - mandatory Google Calendar ID

Optional shortcode attributes:

  • count - number of events to show; if omitted, the plugin uses the default count from settings
  • show_description - true or false; defaults to false

Google API Key and Calendar ID

  1. Create or select a project in the Google Cloud Console.
  2. Enable the Google Calendar API.
  3. Create an API key under APIs & Services -> Credentials.
  4. Use that API key in the plugin settings page.
  5. Get the calendar ID from Google Calendar settings under Integrate calendar.
  6. Use a public or shared calendar ID such as something@group.calendar.google.com.
  7. Do not use an OAuth client ID/secret for this plugin.

Architecture

  • upcoming-calendar-events.php - plugin bootstrap and Composer autoload.
  • src/Plugin.php - main plugin orchestrator.
  • src/Admin/Settings.php - admin menu, settings page, validation, and cache refresh.
  • src/Frontend/Shortcode.php - shortcode registration and AJAX placeholder output.
  • src/Frontend/AjaxRenderer.php - AJAX endpoint for rendering events.
  • src/Api/GoogleCalendarClient.php - Google Calendar API client.
  • src/Cache/CacheManager.php - transient-based caching and cache-key management.