Dustin Cabeal
asked 10 years ago

I’m using the DW Focus theme with WordPress and Jetpack. The problem I’m running into is that Jetpack doesn’t register the fact that my theme has a Facebook open graph element so it’s causing a conflict with Facebook. I would like to disable the theme’s open graph since Jetpack auto posts my artilces on to Facebook. Please let me know how I can do this.
 
Thanks,
Dustin

1 Answers
Wilfred
answered 10 years ago

Hi Dustin
To resolve this issue please follow mu instruction here:
1. Open functions.php file in /wp-content/themes/dw-focus/functions.php
2. Replace the following code – form line 474 to line 496

   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');
}

with

   // 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 !

Dustin Cabeal
replied 10 years ago

You’re fantastic! It not only worked, but for the first time in six months I did’t receive an error when checking a link on Facebook’s debugger. THANK YOU! This made my day.

Powered by DW Question & Answer Pro