Skip to:
Content
Pages
Categories
Search
Top
Bottom

Facebook Like


  • Sven Lehnert
    Participant

    @svenl77

    I got tired of adding the iframe that’s why I have built up a small function, which just gives you the correct Facebook Button anywhere on the site.
    Just copy this function into your functions.php and call “ where ever you want.
    If you want to use it in page and posts or text widgets as shortcode, write [facebook_like]
    `function facebook_like() {
    echo get_facebook_like();
    }
    function get_facebook_like() {

    $pageURL = ‘http’;
    if ($_SERVER[“HTTPS”] == “on”) {$pageURL .= “s”;}
    $pageURL .= “://”;
    if ($_SERVER[“SERVER_PORT”] != “80”) {
    $pageURL .= $_SERVER[“SERVER_NAME”].”:”.$_SERVER[“SERVER_PORT”].$_SERVER[“REQUEST_URI”];
    } else {
    $pageURL .= $_SERVER[“SERVER_NAME”].$_SERVER[“REQUEST_URI”];
    }

    $tmp = ”;
    return $tmp;
    }
    add_shortcode(‘facebook_like’, ‘get_facebook_like’);
    `

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Facebook Like’ is closed to new replies.
Skip to toolbar