I know you posted this four months ago, but just in case you’re still wondering (or someone else stumbled across this site) here’s how I solved the issue for one site:
I altered the plugin code in wp-content/plugins/wp-open-graph-meta/wp-open-graph-meta.php
. I changed the function add_elements()
from this:
public function add_elements()
{
if (is_singular()) {
the_post();
$this->_metas['og:title'] = $this->_get_title();
$this->_metas['og:type'] = is_single() ? 'article' : 'website';
$this->_metas['og:url'] = get_permalink();
$this->_metas['og:description'] = $this->_get_description();
$this->_metas['og:site_name'] = strip_tags(get_bloginfo('name'));
$this->_metas['og:locale'] = strtolower(str_replace('-', '_', get_bloginfo('language')));
$this->_add_image();
$this->_add_post_tags();
$this->_output();
rewind_posts();
}
}
To be this:
public function add_elements()
{
if (is_singular()) {
the_post();
$this->_metas['og:title'] = $this->_get_title();
$this->_metas['og:type'] = is_single() ? 'article' : 'website';
$this->_metas['og:url'] = get_permalink();
$this->_metas['og:description'] = $this->_get_description();
$this->_metas['og:site_name'] = strip_tags(get_bloginfo('name'));
$this->_metas['og:locale'] = strtolower(str_replace('-', '_', get_bloginfo('language')));
$this->_add_image();
$this->_add_post_tags();
$this->_output();
rewind_posts();
}
elseif ( is_home() ) // Added by @tommygeorge:
{
$this->_metas['og:title'] = strip_tags(get_bloginfo('name'));
$this->_metas['og:type'] = 'website';
$this->_metas['og:url'] = home_url();
$this->_metas['og:description'] = strip_tags(get_bloginfo('description'));
$this->_metas['og:site_name'] = strip_tags(get_bloginfo('name'));
$this->_metas['og:locale'] = strtolower(str_replace('-', '_', get_bloginfo('language')));
$this->_output();
}
}
As you should be able to see, I simply added an elseif
condition, and altered the tags I wanted to show up on the front page. It may need further modification to be more friendly with some SEO plugins, or to work properly with a static-page front page. This currently works with a front page that shows posts.