Need To Put A Facebook Share Button(not 'like') In Wordpress Site

Discussion in 'PHP' started by sam_pras, Feb 16, 2013.

  1. #1
    hello all, i need to put a facebook share in my wordpress site. My theme has a file called social.php , which has options for facebook like, twitter share, and google plus share. I am not knowledgeable in coding, it would be great if someone can help me with this. the social.php code is

    <?php
    /**
    * @package WordPress
    * @subpackage Website
    * @since Website 1.0
    */
     
    // Option path
    $option_path = 'social'.(get_post_type() == 'post' ? (is_singular() ? '/single' : '/list') : '');
    $theme_option_path = get_post_type().'/'.$option_path;
    $post_option_path  = 'options/'.str_replace('/', '_', $option_path);
     
    // Social visibility
    $visible = Website::getInheritOption($post_option_path, $theme_option_path.'/visible');
     
    // Social
    if ($visible === true || $visible === 'on') {
     
        $social_items = Website::getThemeOption($theme_option_path.'/items');
     
        if (!empty($social_items)) {
     
            echo '<ul class="social clear">';
     
            $permalink = get_permalink();
     
            foreach ($social_items as $social_item) {
     
                switch ($social_item) {
                    case 'twitter':
                        printf('<li><a href="https://twitter.com/share" class="twitter-share-button" data-url="%s" data-text="%s" data-count="horizontal">Tweet</a></li>', $permalink, esc_attr(get_the_title()));
                        break;
                    case 'facebook':
                        printf('<li><div class="fb-like" data-href="%s" data-send="false" data-layout="button_count"></div></li>', $permalink);
                        break;
                    case 'googleplus':
                        printf('<li><div class="g-plusone" data-size="medium" data-href="%s"></div></li>', $permalink);
                        break;
                    case 'pinterest':
                        printf('<li><div class="fb-like" data-href="%s" data-send="false" data-layout="button_count"></div></li>', $permalink);
                        break;
                }
     
     
            }
        }
     
    }
    PHP:
    I need to put the Facebook share button in place of pinterest. Would someone pls guide me?

    Thanks
     
    sam_pras, Feb 16, 2013 IP
  2. Sano000

    Sano000 Active Member

    Messages:
    52
    Likes Received:
    4
    Best Answers:
    5
    Trophy Points:
    53
    #2
    Just add code at the end of file like that:
    ?>
    Your_like_button_html_code
    Code (markup):
    It is not best way, but it works
     
    Sano000, Feb 16, 2013 IP