Devlog

Google Cloud Setup And Getting Started

The Private Google Calendars plugin displays one or more Google calendars that your Google account has access to. Before you can use this plugin you need to create and setup a Google Cloud project.

Basically the steps are:

  1. Create a Google Cloud project
  2. Authorise the plugin to access the calendars
  3. Select the calendars you want to use
  4. Add one or more of the selected calendars to pages, posts, widgets, etc.

Google Cloud project

Make sure to go to the settings page of the plugin before creating the Google Cloud project because you need the information displayed on this page.

The steps to create and setup a Google Cloud project:

  1. Create a new Google Cloud project in the Google Cloud Console.
  2. Enable the Google Calendar API in your new project.
  3. Create an OAuth client ID in your project.
    1. Choose Webapplication for the type.
    2. Add the authorised redirect URI. Make sure to copy and paste the redirect URI you see in the Private Google Calendars settings page in the orange box exactly as displayed, otherwise it will not work.
    3. Click on Create and download the client secret JSON file, because this file must be uploaded to the WordPress plugin.

Publishing status

By default your project will be in the "Testing" publishing status. This means that you will see a warning when you want to authorise the plugin to have access to your Google account (but as you only have to do this and only have to do this once, this isn't a problem). But it also means that these authorisations will expire every 1 or 2 weeks. To make sure this won't happen it's important to set the publishing status to "Production". This will require a verification by Google.

Setting up the plugin

After you created the Google Cloud project and downloaded the client secret JSON file, you can setup the plugin.

  1. Go to the Private calendar settings section of the settings page and upload the client secret JSON file.
  2. Authorise this plugin to access the calendars in your Google account. Note that Google may display a warning here that this application has not been verified. This is okay, just make sure to go on. After everything is setup you can ask Google to verify your application, but this is out of the scope of this document.
  3. If everything went well, you'll now see all the calendars this plugin has access to. Select the calendars you want to use. Maybe you have calendars that you never want to display so don't select these calendars here. Note that later on on each page you can choose which calendars you want to display.
  4. After saving your settings you can start using the plugin.

Using the plugin

You can display calendars by using the shortcode, from inside the Gutenberg block editor and as widgets.

Shortcode

You can set many options, but the most basic shortcode:

[pgc]

And the result:

Gutenberg block

Just add the Private Google Calendars block and select the calendars you want to display.

Widget

Add the widget and select the options.