Strict Standards: Redefining already defined constructor for class bbdb in /home/themes/public_html/forums/bb-includes/db-mysql.php on line 12

Strict Standards: Declaration of BB_Walker_Blank::start_lvl() should be compatible with BB_Walker::start_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_lvl() should be compatible with BB_Walker::end_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::start_el() should be compatible with BB_Walker::start_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_el() should be compatible with BB_Walker::end_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Warning: Cannot modify header information - headers already sent by (output started at /home/themes/public_html/forums/bb-includes/db-mysql.php:12) in /home/themes/public_html/forums/my-templates/kakumei-variant/rss2.php on line 1
ThemeShaper Forums Topic: How to: Facebook Open Graph <meta> Help In Shaping WordPress Themes en Fri, 29 May 2015 02:08:16 +0000 sunysky on "How to: Facebook Open Graph <meta>" Tue, 09 Nov 2010 23:33:14 +0000 sunysky 16858@ <p>It works!<br /> Thank a lot Chris! :) </p> Chris on "How to: Facebook Open Graph <meta>" Tue, 09 Nov 2010 20:02:44 +0000 Chris 16848@ <p>It should be add_filter.</p> <p>Chris </p> sunysky on "How to: Facebook Open Graph <meta>" Tue, 09 Nov 2010 16:33:34 +0000 sunysky 16846@ <p>Hi,</p> <p>When I try your solution my wordpress crash and I obtain this error message:</p> <p>Fatal error: Call to undefined function apply_filter() in /public_html/photo/wp-content/themes/autofocusplus/functions.php on line 36</p> <p>The line 36 is:<br /> apply_filter('thematic_create_doctype', 'open_graph_doctype');</p> <p>I have wordpress 3.0.1 with Autofocus+ theme wich is based on Thematic theme.<br /> <a href="" rel="nofollow"></a></p> <p>Do you know where is the problem? </p> <p>Thank you in advance!</p> <p>PS: excuse my english, i'm french... </p> Ben W. on "How to: Facebook Open Graph <meta>" Sun, 06 Jun 2010 11:35:16 +0000 Ben W. 12840@ <p>If you are using the Facebook “Like” button on your page, you may want to have a better control over it – including an Admin page. (<a href="">More about Open Graph protocol.</a>)</p> <p>You'll need a logo image for your blog and put it to your Thematic /images/ directory, or, if you are using a child theme, to your child themes /images/ directory. Put the following code snippet to your functions.php of Thematic, or, if you are using a child theme, of your child theme:</p> <p>(If you need to find out your Facebook ID, click on the "Photos" tab of your FB profile, select your profile photos, and grab the number of the <a href="" rel="nofollow"></a>…&#38;id=YOUR_ID part.)</p> <pre><code>/* * Facebook Open Graph */ function open_graph($content) { $content .=&#39;&lt;meta property=&quot;fb:admins&quot; content=&quot;YOUR_FACEBOOK_ID&quot; /&gt;&#39; . &quot;\n&quot;; if (is_home() || is_front_page()) { $url = get_option(&#39;home&#39;); $title = get_bloginfo(&#39;name&#39;); $description = get_bloginfo(&#39;description&#39;); $article = &#39;blog&#39;; } else { global $post; $url = get_permalink($post-&gt;ID); $title = get_the_title(); $description = get_the_excerpt(); $article = &#39;article&#39;; } $content .=&#39;&lt;meta property=&quot;og:site_name&quot; content=&quot;&#39; . get_bloginfo(&#39;name&#39;) . &#39;&quot; /&gt;&#39; . &quot;\n&quot;; $content .=&#39;&lt;meta property=&quot;og:title&quot; content=&quot;&#39; . $title . &#39;&quot; /&gt;&#39; . &quot;\n&quot;; $content .=&#39;&lt;meta property=&quot;og:description&quot; content=&quot;&#39; . $description . &#39;&quot; /&gt;&#39; . &quot;\n&quot;; $content .=&#39;&lt;meta property=&quot;og:type&quot; content=&quot;&#39; . $article . &#39;&quot; /&gt;&#39; . &quot;\n&quot;; $content .=&#39;&lt;meta property=&quot;og:url&quot; content=&quot;&#39; . $url . &#39;&quot; /&gt;&#39; . &quot;\n&quot;; $content .=&#39;&lt;meta property=&quot;og:image&quot; content=&quot;&#39; . get_bloginfo(&#39;stylesheet_directory&#39;) . &#39;/images/YOUR_LOGO.jpg&quot; /&gt;&#39; . &quot;\n&quot;; return $content; } add_filter (&#39;thematic_create_description&#39;, &#39;open_graph&#39;); function open_graph_doctype($content) { $content = &#39;&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;;&gt;&#39;; $content .= &#39;&lt;html xmlns=&quot;; xmlns:og=&quot;; xmlns:fb=&quot;;&#39;; return $content; } apply_filter(&#39;thematic_create_doctype&#39;, &#39;open_graph_doctype&#39;);</code></pre> <p>Please note that the document won't validate as XHTML 1.0 Transitional anymore. Changing it to the required DOCTYPE XHTML + RDFa (<code>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML+RDFa 1.0//EN&quot; &quot;;&gt;</code>) would make it almost like XHTML 1.1, which is Strict, but will easily brake existing forms etc.</p> <p>If you are not using a caching solution (like WP Super Cache or Hyper Cache), you could restrict the meta tags to be shown the Facebook crawler only:</p> <pre><code>function open_graph($content) { if ($_SERVER[&#39;HTTP_USER_AGENT&#39;] == &#39;facebookexternalhit/1.0 (+;) { [the stuff from above] } }</code></pre> <p>Enjoy! </p>