One of the requests I got from my current client is to embed Google Groups discussions into a page/post on WordPress.
First of all before you read further, I think you should consider your Google Group settings – public or private? If you make your group private (members only, so users have to apply to get access to the group content) you won’t be able to expose it to the public and this works also if you embed it. The same should stand for exposing the group through API but I have not tested this yet, in this post I will only cover plugin or code embedding.
So if your group is public then you should read ahead. The first option you have, for example if you’re only embedding one group is to just add the code on this page on your post or page changing forum-name to your group name (which you can find in the URL of your group i.e. the “angrybirdsdaylondon” in https://groups.google.com/forum/#!forum/angrybirdsdaylondon )
<iframe id="forum_embed" src="javascript:void(0)" scrolling="no" frameborder="0" width="900" height="700"> </iframe> <script type="text/javascript"> document.getElementById("forum_embed").src = "https://groups.google.com/forum/embed/?place=forum/forum-name" + "&showsearch=true&showpopout=true&parenturl=" + encodeURIComponent(window.location.href); </script>
Before I take you through a few extra options, you should know that if your group belongs to an organisation then you will need to specify that in the settings. If you don’t you’ll get an iframe populated with posts on sex and viagra and you so don’t want your client to see that, right?
The setting you need is
So you can personalise the output by adding the following settings to the URL i.e. https://groups.google.com/forum/embed/?place=forum/forum-name&domain=yourdomain.com&showpopout=true&theme=default
- showsearch: whether to show an embedded search box on destination forum pages. (default is false)
- showpopout: whether to show the “popout” button which lets the view be expanded to a full page, on destination forum pages (default is true)
- hideforumtitle: if you want to show the forum title and description, false if you don’t want to show the title or description (default is true)
- hidesubject: if you want to hide the subject of the last post in My Forums view, false if you want to leave the subject visible (default is true)
- showtabs: whether to show tabs for changing views (e.g., to the Members view), on destination forum pages (default is false)
- width: the width of page (default is 100%)
- height: the height of page (default is 800px)
Your other option, especially if you want to display multiple groups or different groups in different pages and posts, is to download Odyno Google Groups made by a fellow Italian, Alessandro Staniscia.
The setup is very easy. You just install the plugin then you add the following shortcode to a page or post, just swap “name-of-group” with your group name:
[google_groups name="name-of-group"]
The same settings as above apply to the plugin too, for example from Alessandro’s site
[google_groups name="mixare-development" width = '100%' height = '800px' showsearch = 'true' showtabs = 'true' hideforumtitle = 'true' hidesubject = 'true']
Recent Comments