I have seen other articles that point me to functions.php but I could not find the og:image parameter in that file. Can you point me in the right direction?
You can open the function.php file, then add the following code under line 524.
if( ! function_exists('dw_focus_post_views') ) {
/**
* Views count for a single post
*/
function dw_focus_post_views() {
if( is_single() ){
global $post;
$view = get_post_meta($post->ID, '_views', true);
$view = $view ? $view+1 : 1;
update_post_meta($post->ID, '_views', $view);
echo '<meta property="og:title" content="'.get_the_title().'" />';
echo '<meta property="og:url" content="'.get_permalink().'" />';
if( has_post_thumbnail() ) {
$thumb_id = get_post_thumbnail_id();
$thumb = wp_get_attachment_thumb_url( $thumb_id );
echo '<meta property="og:image" content="'.$thumb.'" />';
}
echo '<meta property="og:description" content="'. esc_html( get_the_excerpt() ) .'"/>';
}
}
add_action('wp_head', 'dw_focus_post_views');
}
Hope this helps !
It does, but it also creates 2 new issues:1) The sharing section is thrown under the article:https://www.evernote.com/shard/s126/sh/82837229-ed31-4f0e-8767-3519746592d9/5bc8bf88d7a26950d66c33e027212aad2) When testing with Object debugger (https://developers.facebook.com/tools/debug/og/object/) I get this new error:https://www.evernote.com/shard/s126/sh/1c4d0696-de98-4b69-ad44-43cb02b359d4/c594bbd2aaca427fc52883b45369a0d6
1 thing to note, this only happens when the Plugin “Jetpack” is enabled. I now believe this to happen only when that plugin is on, and thus I don’t see this as an issue directly with this Theme.
OK, you can fix this issue by following these directions:
http://jetpack.me/2013/05/03/remove-open-graph-meta-tags/
Essentially you add
add_filter(
'jetpack_enable_open_graph'
,
'__return_false'
);
To your functions.php file in your theme.
Please login or Register to submit your answer