Install
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/duppinstech/gbp-posts-slider/archive/refs/heads/main.zipA WordPress plugin that pulls your Google Business Profile posts and displays them in a responsive, accessible slider on your website.
Posts are cached locally as a custom post type so the front end never makes a live API call — fast and reliable.
Features
- One-click Google connect — define credentials in
wp-config.phpand end-users just click a button - Posts cached as a private CPT for front-end performance
- Automatic hourly sync via WP-Cron + manual sync button
- Responsive Swiper.js carousel (1 → 2 → 3 columns)
- Post images, dates, and call-to-action buttons
- CSRF-protected OAuth flow (state token)
- Accessible markup with ARIA labels and
loading="lazy"images - Shortcode with configurable attributes
Requirements
| Requirement | Version |
|---|---|
| WordPress | 6.0+ |
| PHP | 7.4+ |
Installation
1. Google Cloud Setup
- Go to Google Cloud Console and create a project.
- Enable My Business Posting API under APIs & Services → Library.
- Configure OAuth consent screen (External; add your account as a test user for internal use).
- Create an OAuth 2.0 Client ID (Web application type).
- Add the plugin's redirect URI as an Authorized redirect URI — you'll find the exact URI in the plugin settings page.
2. Plugin Setup
Option A — credentials in wp-config.php (recommended for single-site / managed installs)
End-users see only a "Connect" button — no credential fields exposed:
// wp-config.php
define( 'GBP_CLIENT_ID', 'YOUR_CLIENT_ID.apps.googleusercontent.com' );
define( 'GBP_CLIENT_SECRET', 'YOUR_CLIENT_SECRET' );
Option B — enter credentials in the admin
Leave the constants undefined; the credential fields will appear in Settings → GBP Posts Slider.
3. Connect & Configure
- Go to Settings → GBP Posts Slider.
- Click Connect Google Business Profile and complete the consent screen.
- Enter your Account ID and Location ID (numeric only, no prefix).
- Click Sync Now to pull your posts immediately.
- Add the shortcode to any page.
Shortcode
[gbp_posts_slider]
| Attribute | Default | Description |
|---|---|---|
limit |
6 |
Number of posts to display |
show_images |
true |
Show post images |
show_date |
true |
Show post date |
autoplay |
true |
Enable carousel autoplay |
slides_per_view |
3 |
Max slides on desktop (1–6) |
Example:
[gbp_posts_slider limit="4" autoplay="false" slides_per_view="2"]
Troubleshooting
Error 400: invalid_request
The redirect URI in your Google Cloud OAuth client does not exactly match the one the plugin sends. Copy the URI shown in Settings → GBP Posts Slider and add it as an Authorized redirect URI in Google Cloud Console.
"This app doesn't comply with Google's OAuth 2.0 policy"
Your app is in Testing mode. In Google Cloud Console go to APIs & Services → OAuth consent screen → Test users and add the Google account you're using to sign in.
For a production/public deployment you must complete Google's OAuth verification process.
Posts not showing
- Verify you're connected (Settings → GBP Posts Slider shows "Connected").
- Confirm Account ID and Location ID are correct (numeric only).
- Click Sync Now and check the count.
- Check that WP-Cron is running on your server (
define('DISABLE_WP_CRON', true)would break automatic sync).
Hooks & Filters
| Hook | Type | Description |
|---|---|---|
gbp_posts_slider_refresh |
Action (cron) | Fired hourly to sync posts |
More filters will be added in future releases.