Note: Google+ is now a depreciated platform. The article is for reference only.
Continuing in the spirit of articles that detail some Google+ features for WordPress, the latest post will show you how to embed a Google Plus post into a WordPress post or page with shortcode.
From Google's 2013 blog post detailing the new (at the time) feature, they said that "... with embedded posts, site owners can now add your public Google+ posts to their web pages - as a primary source, for example, or to highlight your point of view. Text, photo and media posts are all supported, and the embeds are fully interactive, so visitors can +1, comment and follow you inline."
Since the post by Google was first written, Google have removed the +1 feature and they've buried the share options so deep into the system that they're impossible to find (if indeed they even still exist). Despite our somewhat wavering commitment to Google Plus, this post will show you how to embed a Google+ post into your WordPress website with shortcode.
To avoid constructing an invalid URL, we've altered the function since it was first published on Internoetics.
The Result
The shortcode of [googleplusembed user="+MartyKhoury" post="8ZPQm31zT8P"]
will return the following:
No longer available
The correct canonical URL format for an embed (as constructed in our shortcode) is as follows:
https://plus.google.com/nnnnnnnnnnnnnnnnn/posts/XXXXXXXXXXXXX
Embedding a post from a page URL is no different to that of a user. An old post from the Internoetics Google+ page (using [googleplusembed id="+Internoetics" post="faaiLPA6rkG"]
is as follows:
No longer available
WordPress Shortcode
This function requires that Google's Platform JavaScript function be rendered on your page. You can download the function or plugin here.
Copy and paste the WordPress function into your theme's functions.php
file or, if you sensibly have one installed, your custom functions plugin.
If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.
Shortcode Attributes
user
id
or username
of the Google+ user or page.post
/posts/
in the URL.p
p="0"
.PHP Function
Used outside of WordPress, the following may be used. Use of Google's platform.js
JavaScript is required.
Usage is as follows:
Download
No longer available.