ThemeShaper Forums » Thematic


Facebook Like Button Social Plugin not working with Thematic

(4 posts)
  • Started 8 years ago by jfeitlinger
  • Latest reply from fwunder
  • This topic is not resolved
  1. Hello,

    I have tried numereous different Facebook Like Wordpress plugins and none are working since Wordpress upgraded to version 3.1.

    Do you have any advice:

    1) Which Facebook Like Plugin works?
    2) How to get this to work?

    Thank you,

    Posted 8 years ago #
  2. fwunder

    I thought I would resurrect this question and share what I did to finally make the Facebook Like button work. I wasn't happy with any of the Wordpress plugins, so I jumped into the Facebook Developer code to try and figure out how to make it play nice with Thematic.

    My first (and probably most important) tip is to make sure you are always working with a cleared cache!! I ran into numerous "problems" because I had either not cleared my browser(s) cache or had not turned off my wordpress caching plugin. Took me a while to figure that one out!

    You can generate the relevant Facebook codes @

    After messing around quite a bit, I found that the iframe code worked best. You will find that when you click "get code"

    I also generated the "open graph tags" which you will find explained on the page above.

    After gathering the code snippets, I need to get them into Thematic. The code below should be self explanatory. REPLACE the content snippets with your own! The Get Like Button Code and Open Graph Tag generator at the link above will generate them for you. I left exactly what I used as it is public info anyway as it is placed in the page head (view page source to see what's below).

    Although probably not necessary (the Facebook documentation is a bit confusing) I took a kitchen sink approach adding the doctype filter.

    Also, the way I implemented it, the "Like" button is site wide and not page specific. Perhaps someone else will write that tutorial! ;)

    Sooooo, without further babbling, this is what is currently working in my child functions.php:

    // Action hook for placing facebook iframe code above container
    function social_stuff() {
    	echo ('<div id="social">');
          echo ('<iframe src="//" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:600px; height:35px;" allowTransparency="true"></iframe>');
    	echo ('</div>');
    add_action ('thematic_abovecontainer', 'social_stuff');
    // Filter for adding facebook html header stuff
    function my_create_doctype($content) {
        $content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">' . "\n";
        $content .= '<html xmlns=" xmlns:og="" xmlns:fb=""';
        return $content;
    add_filter('thematic_create_doctype', 'my_create_doctype');
    // Filter for adding open graph tags
    function facebook_meta() {
    echo ('<meta property="og:title" content="Tim Wunderlich" />'."\n");
    echo ('<meta property="og:type" content="athlete" />'."\n");
    echo ('<meta property="og:url" content="" />'."\n");
    echo ('<meta property="og:image" content="" />'."\n");
    echo ('<meta property="fb:admins" content="ID" />'."\n");
    echo ('<meta property="og:description" content="Thanks for visiting my blog. I am currently coaching and completing my graduate degree with UCM while continuing to train as a post-collegiate decathlete."/>'."\n");
    add_filter('wp_head', 'facebook_meta');

    It's really not as bad as it looks. I hope this may help others save some time. I spent wayyyy too much time struggling to make it work.

    You can see how it works @

    I did add some custom CSS to my child CSS for placement.

    Being the novice that I am, there may be a better and easier solution. I sure would be interested in others' experiences.

    Again, if you are a copy-paste coder like me and use the code I used above, be sure to CHANGE the relevant "content" snipplets!


    Posted 7 years ago #
    I myself have tried to fix this the last week for a client. For the first time I have built my own theme and this is also the first time using thematic. I used this tool to check that everything was in order, and figured out that I have to put my “og:url” without “www” Now I just have to wait for my client to give me his ID and hopefully everything will be all right!
    I used mine in the footer, and added one more echo to the function social_stuff to also get twitter at the same place.
    So thank you for this code snippet! You can see your code in action right here

    Posted 7 years ago #
  4. fwunder

    @Susnos, I'm glad it seemed to work for you. You probably already figured out you don't need all those "echo" statements and write it easier like:

    // Action hook for placing facebook iframe code above container
    function social_stuff() {  ?>
    	<div id="social">
           <iframe> ...</iframe>
    <?php }
     add_action ('thematic_abovecontainer', 'social_stuff');

    saves some keystroke trees. ;)

    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.