WordPress.org

Ready to get started?Download WordPress

Forums

Facebook Like Button works with Html Page but Not php Blog (3 posts)

  1. richardpowell
    Member
    Posted 4 years ago #

    Hey so I created a Html page HERE and the facebook like button code works perfect, it shows on FB as:

    NAME likes Richard Powells Blog Post on http://www.richardpowell.ie

    If I add the same codes into my single.php page of the blog I get an error and if it does happen to work I get

    NAME likes Richard Powell on Richard Powell

    but mostly it hasnt worked.

    HELP!

    the Code I Used it:

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:fb="http://www.facebook.com/2008/fbml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Richard Powell's Blog Post</title>
    </head>
    <body>
    <h1>Richard Powell's Blog Post</h1>
    <p><fb:login-button autologoutlink="true"></fb:login-button></p>
    <p><fb:like></fb:like></p>

    <div id="fb-root"></div>
    <script>
    window.fbAsyncInit = function() {
    FB.init({appId: '128924280458506', status: true, cookie: true,
    xfbml: true});
    };
    (function() {
    var e = document.createElement('script');
    e.type = 'text/javascript';
    e.src = document.location.protocol +
    '//connect.facebook.net/en_GB/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
    }());
    </script>
    </body>
    </html>

  2. Mr E
    Member
    Posted 4 years ago #

    I'll guess that your only using whats inside the BODY tags.

    Even if that's the case, html is limited in WordPress however I've had luck running Raw HTML Plugin to allow most html code to be utilized.

  3. richardpowell
    Member
    Posted 4 years ago #

    The code within the </Head> tags is the Facebook like button. I can add that to a html document and it works perfect, I add it to my single.php to place under comments and it flags an error when clicked!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.