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:
- Create a Google Cloud project
- Authorise the plugin to access the calendars
- Select the calendars you want to use
- 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:
- Create a new Google Cloud project in the Google Cloud Console.
- Enable the Google Calendar API in your new project.
- Create an OAuth client ID in your project.
- Choose Webapplication for the type.
- 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.
- Click on Create and download the client secret JSON file, because this file must be uploaded to the WordPress plugin.
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.
- Go to the Private calendar settings section of the settings page and upload the client secret JSON file.
- 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.
- 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.
- 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.
You can set many options, but the most basic shortcode:
And the result:
Just add the Private Google Calendars block and select the calendars you want to display.
Add the widget and select the options.