Implements the Open Graph Protocol on a WordPress installation. Can be used by other plugins as a dependency.
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 enable any web page to have the same functionality as a Facebook Page.
While many different technologies and schemas exist and could be combined together, there isn’t a single technology which provides enough information to richly represent any web page within the social graph. The Open Graph protocol builds on these existing technologies and gives developers one thing to implement. Developer simplicity is a key goal of the Open Graph protocol which has informed many of the technical design decisions.
Use add_action('open_graph_head_pre','your_function');
and add_action('open_graph_head_post','your_function');
to edit the meta data. For an instance of the class.
Always use open_graph_instance()
Read more on the Plugin URI > Open Graph WP implementation or check out the FAQs
open-graph.php
to the /wp-content/plugins/
directoryopen_graph_protocol_logo.png
for now)You can add/edit meta data by using 2 actions ‘open_graph_head_pre’ and ‘open_graph_head_post’.
‘open_graph_head_pre’ executes before the setup takes place.
‘open_graph_head_post’ executes after the setup but before echoing meta data.
I’ll add more functions for editing in later versions.
add_action('open_graph_head_pre','my_function')
.my_function
grab an instance $og = open_graph_instance();
and call $og->set_default_img( $url );
'open_graph_head_post'
action and $og->set_og_data( 'og:image' => $url )
but this will over ride for all pages/ posts etcadd_action('open_graph_head_pre','my_function')
.my_function
grab an instance $og = open_graph_instance();
and call $og->set_home_type( $type );
'open_graph_head_post'
action and if(is_home()) { $og->set_og_data( 'og:type' => $type );}