HelloCW
HelloCW

Reputation: 2275

How to remove facebook like button social text?

I would like to remove the social text from the facebook like button in order to fit into the width, you can see Image 1.

I have read the article.

But when I access https://developers.facebook.com/docs/reference/plugins/like/ , I can change the "layout to button_count", but I can't find "uncheck send button". How can I do?

BTW, In the official website, it can display a Like Button without text, you can see Image 2.

Image 1

enter image description here

Image 2

enter image description here

Upvotes: 1

Views: 365

Answers (2)

Alijvhr
Alijvhr

Reputation: 2263

I tested and this only shows like button:

<div class="fb-like"
  data-href="https://developers.facebook.com/docs/plugins/"
  data-width="500"
  data-layout="button"
  data-action="like"
  data-size="small"
  data-share="false"></div>

As you know you should have this in your head tag and also add your keys to it:

<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v16.0" nonce="vnvxh4b9"></script>

You can add app ID after version=v16.0 like this. 123456789 is your app ID:


```html
<script async defer crossorigin="anonymous"
   src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v16.0&appId=123456789"
   nonce="vnvxh4b9"></script>

Also you can use CSS to hide everything else:

```css
.fb-like {
    width: 60px !important;
    overflow: hidden !important;
    height: 20px !important;
}

See the result in JsFiddle

**Note: If you want to show count on button just change data-layout="button" in the div to

data-layout="button_count"

And respectfully increase the width if you use CSS!

Upvotes: 0

rafa226
rafa226

Reputation: 546

Have yo tried the suggested code instead of the FB button generator ? Here you go :

<html>
<head>
  <title>Your Website Title</title>
    <!-- You can use open graph tags to customize link previews.
    Learn more: https://developers.facebook.com/docs/sharing/webmasters -->
  <meta property="og:url"           content="https://www.your-domain.com/your-page.html" />
  <meta property="og:type"          content="website" />
  <meta property="og:title"         content="Your Website Title" />
  <meta property="og:description"   content="Your description" />
  <meta property="og:image"         content="https://www.your-domain.com/path/image.jpg" />
</head>
<body>

  <!-- Load Facebook SDK for JavaScript -->
  <div id="fb-root"></div>
  <script async defer crossorigin="anonymous" 
        src="https://connect.facebook.net/fr_FR/sdk.js#xfbml=1
             &version=v16.0
             &appId=YOURAPPID
             &autoLogAppEvents=1" 
        nonce="FOKrbAYI">
  </script>

  <!-- Your like button code -->
  <div class="fb-like" 
       data-href="https://www.your-domain.com/your-page.html" 
       data-width=""
       data-layout="button_count" 
       data-action="like" 
       data-size="small"  
       data-share="false">
  </div>

</body>
</html>

enter image description here

Upvotes: 1

Related Questions