
The Open Graph protocol enables any web page to become a rich object in a social graph. For instance, this is used on Facebook to allow any web page to have the same functionality as any other object on Facebook.
This WordPress plugin is aimed at automating the process of adding basic and optional metadata to a site’s pages. It is also designed to act as a framework for other plugins or themes and allows to modify and adapt the information provided as needed.
If you find this plugin useful and would like to support our work, you can do so by purchasing in our Shop, thank you!
Install and activate the plugin. It will automatically render the following metadata for posts, pages, etc. :
og:title : The page’s title is used, this provides the title for posts, pages, archives etc.og:type : The type will be article in general, website for the front page and blog for the blog homepage.og:image : For post types that support featured images, the URL of the featured image is used. Additional metadata og:image:width and og:image:height is added.og:url : The URL of the current page.og:site_name : The name of the site.og:description : Uses the full excerpt if available, otherwise derives it from the content. For author and archive pages, the type of page and title is used.og:locale : The current locale.og:locale:alternate : Indicates additional locales available if WPML is installed.This section is for developers. If you’re not a developer, you can safely skip it.
The plugin provides the following filters:
open_graph_protocol_metaThis filter allows to modify the value of the content attribute for a given meta tag.
It is invoked for every supported type of metadata.
Parameters:
string content – the current value of the content attributestring property – the metadata name, for example og:titleFilters must return:
string the desired value of the content attributeopen_graph_protocol_meta_tagThis filter allows to modify the actual HTML <meta> tag that is rendered in the <head> section of pages.
Parameters:
string HTML <meta> tagstring property – the metadata name, for example og:titlestring content – the value of the content attributeFilters must return:
– string the desired output for the HTML <meta> tag
open_graph_protocol_metasThis filter allows to add or remove metadata before it is rendered.
Parameters:
array of metadata indexed by metadata nameFilters must return:
– array of metadata indexed by metadata name
open_graph_protocol_echo_metasThis filter allows to modify the HTML that renders the plugin’s meta tags in the <head> section.
Parameters:
string HTML with <meta> tags to be renderedFilters must return:
– string HTML with <meta> tags to be rendered
This plugin was created because we needed an extendable way to render meta tags based on the Open Graph protocol, which would allow to modify the meta tag content rendered or add meta tags when appropriate based on external data.
None of the existing plugins provided a sufficiently flexible way of doing that, among other reasons we needed a solution that would comply with all of these requirements and none of the existing solutions does:
The logo used for this plugin’s icon and banner is the Open Graph protocol logo by Facebook – ogp.me. Licensed under Public Domain via Wikimedia Commons.
Download & install the zip archive
The plugin package installer can be downloaded from the WP2E project tab called “code”.
1 – Select the version to download if this option is available otherwise the “latest” version of the main plugin will be used.
2 – After downloading the zip archive install the plugin package installer in you local environment and activate the script from the plugin list.
3 – Under the section “Plugins” of the admin dashboard you should see a new “Dependencies & Licenses” link. Follow the instructions from this panel to finalize the installation of the missing dependencies.
Tips: Use the WP2E panel to add/suggest new dependencies to the local installation. Press F5 in the list of dependencies if the changes are not displayed right away.