How to translate the Facebook Like button and replace Tweet button with +1

Posted in: Newspaper
Post count: 200

Hi guys,

I need to change the Facebook Like button from English to Bulgarian language (Харесвам)

View post on imgur.com

How can I do that?

As well as I need to change the tweet button with Google’s +1 Is that possible?

Thanks!

Post count: 20688

Hi,

You could change the language of the like button like this. This is the file where you will need to make modifications
https://www.screencast.com/t/l3g0C0DFKWiJ
Please edit the code exactly like in the screenshot below
https://www.screencast.com/t/pFafGOWdftc
With this result – https://www.screencast.com/t/k9wI7tQx
For the tweet button I don’t understand exactly what you want to do. If you have a code for a different social button the only way to insert it would be to place it in that file
https://www.screencast.com/t/h17gEWzyN
There you can see how the Facebook and Tweeter buttons are implemented.
At the moment there are no default options to add more socials in the post sharing. More options may be added in future theme updates regarding this.

Thanks

Post count: 200

Hi,

thanks for the explanation. It seems easy, but for some reason it isn’t working on my side.

I followed exactly your instructions, but the language doesn’t change.

As for the twitter button – I would like to remove the twitter button and tried with removing the following code from the same file:

$buffy .= ‘<li class=”td-classic-twitter”>’;
$buffy .= ‘href) . ‘” data-text=”‘ . $this->title . ‘” data-via=”‘ . td_util::get_option(‘tds_’ . ‘social_twitter’) . ‘” data-lang=”en”>tweet <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=”//platform.twitter.com/widgets.js”;fjs.parentNode.insertBefore(js,fjs);}}(document,”script”,”twitter-wjs”);</script>’;
$buffy .= ‘‘;

But the button isn’t disappearing.

Note: I’m talking about the buttons at the end of the post pages, not under the title.

This is the only cache that I’m seeing in my page source code (I don’t use a caching plugin):

var tdLocalCache = {};

( function () {
“use strict”;

tdLocalCache = {
data: {},
remove: function (resource_id) {
delete tdLocalCache.data[resource_id];
},
exist: function (resource_id) {
return tdLocalCache.data.hasOwnProperty(resource_id) && tdLocalCache.data[resource_id] !== null;
},
get: function (resource_id) {
return tdLocalCache.data[resource_id];
},
set: function (resource_id, cachedData) {
tdLocalCache.remove(resource_id);
tdLocalCache.data[resource_id] = cachedData;
}
};
})();

And finally, is this theme update safe solution? Will it remain after theme update?

Thanks for all your time and support! Much appreciated!

Post count: 20688

Hi,

In that file there are two sections. One containing the top sharing for the posts
https://www.screencast.com/t/EV7SJEjna
And lower in that file is a section with the bottom sharing of the post
https://www.screencast.com/t/cXKawQ2l3SRS
You will have to make modifications according to where you want them to display, top or bottom. To change the language for the Facebook like in the bottom sharing enter the code exactly like this
https://www.screencast.com/t/RCIUxAqBO8F
https://www.screencast.com/t/zY1y16MXVC
https://www.screencast.com/t/2puNN5QuU

This is the code used locale=bg_BG&
There you can remove the twitter button for the section you want, by commenting or deleting the code
https://www.screencast.com/t/nkhl0Fkjjs
Or you could simply hide it with css
https://www.screencast.com/t/yq9ent8qrKg

.single #twitter-widget-1 {
display: none;
}

You could make the modifications to this file in a child theme if you don’t want to make them after each theme update. The respective file can be modified through a child theme.
Here is a guide about cresting a child theme and how to use it
https://forum.tagdiv.com/the-child-theme-support-tutorial/

Thanks

Post count: 200

Cheers for that, mate!

Can you tell me how to add a Google +1 button just before the translated Facebook Like button?

And one more thing – is it possible to set Pinterest share button to fetch all images —
and more important their real resolution files, instead of only the featured image of the article? This is very important.

We actually don’t use twitter and don’t need twitter buttons or requests anywhere. Can I remove scripts that are makeing unnecessary twitter requests somehow?

Thanks!

  • This reply was modified 9 years by DaveS.
Post count: 20688

Hi,

You can remove the Twitter share from the code in both cases (top and bottom sharing) or just disable the top one from the theme panel if you don’t need it
https://www.screencast.com/t/8FH2KVAt
You could add another sharing option, but only by a plugin or widget. By default there are no options to add more sharing options on the post page. Maybe more settings will be added in future updates in the matter.
The same for the Pinterest functionality, it would be better to use a plugin that has these options for more customization, if there are any.

Thanks

Post count: 200

Thanks Simion, much appreciated.

I removed also the following code:

$twitter_user = td_util::get_option(‘tds_tweeter_username’);

Hope that doesn’t make any mess. Everything loads normally so far.

Viewing 7 posts - 1 through 7 (of 7 total)
The forum ‘Newspaper’ is closed to new topics and replies.