You are here:  » Facebook OG Properties Best Practice


Facebook OG Properties Best Practice

Submitted by twdesigns on Thu, 2018-03-22 11:56 in

Good morning David,

I wanted to see if you could tell me the best practice for inserting the following but for the plugin. I tried various plugins but once the product is shared facebook pulls in the wrong one, even though the debugger shows me that it's correct based on their best guess. Also where to put it in the plugin.

<!--FB Like properties-->
<meta property="fb:app_id" content="000000000000" />
<meta property="og:type" content="article" />
<meta property="og:site_name" content="www.example.com"/>
<meta property="og:title" content="<?php print $product["products"][0]["name"]; ?>" />
<meta property="og:image" content="<?php print $product["products"][0]["image_url"]; ?>" />

Thanks in advance!

Submitted by support on Thu, 2018-03-22 12:45

Hi Tommy,

For the equivalent of the above for the plugin, edit pto.php and look for the following code at line 732:

      print "<meta name='description' content='".htmlentities($description,ENT_QUOTES,get_option("blog_charset"))."' />\n";

...and REPLACE with:

      print "<meta name='description' content='".htmlentities($description,ENT_QUOTES,get_option("blog_charset"))."' />\n";
      print "<meta property='fb:app_id' content='000000000000' />";
      print "<meta property='og:type' content='article' />";
      print "<meta property='og:site_name' content='www.example.com'/>";
      print "<meta property='og:title' content='".htmlentities($pto_productResults[0]->name,ENT_QUOTES,get_option("blog_charset"))."' />";
      if ($pto_productResults[0]->image_url)
      {
        print "<meta property='og:image' content='".htmlentities($pto_productResults[0]->image_url,ENT_QUOTES,get_option("blog_charset"))."' />";
      }

Cheers,
David.
--
PriceTapestry.com

Submitted by twdesigns on Thu, 2018-03-22 21:01

David,

That did the trick for passing the debugger. I have something else wrong as once it posts it's not correct, but that could be on my end as I need to dig a little more.

Thanks again!

Tommy