How to add custom Facebook like and share buttons under post titles?

Posted in: Newspaper
Post count: 200

Hi guys,

Which files I should edit in order to add custom Facebook like and share buttons under post titles?

I need to add this code:

<div id=”fb-root”></div>
<script async defer crossorigin=”anonymous” src=”https://connect.facebook.net/bg_BG/sdk.js#xfbml=1&version=v3.3&appId=XXXXXXXXXXX&autoLogAppEvents=1″></script&gt;

It should load these buttons: https://www.dropbox.com/s/x3b9mvdqois3iyj/Facebook%20Like%20and%20Share%20buttons%20GD-fronend.jpg?dl=0

Thanks

Post count: 18283

Hello !

I have tried but the code seems to be wrong. WordPress or Newspaper theme cannot render it. Please check if the code you copied is correct: https://www.screencast.com/t/EGHhrle6yrUg ; https://www.screencast.com/t/fHuyT6m6OY3

Thank you !

Post count: 200

I did not provide the real code. There should be numbers istead of XXXX-es and there is another part of code that goes within the body tag.

Just need to know which files and where to edit.
Thanks

Post count: 18283

Hello !

Ok, so you will have to create a single post template, add a text with title element in it. And paste the code in the text mode as shown in the previous reply. Find out more about single post templates from the cloud library here: https://forum.tagdiv.com/design-post-pages-using-cloud-library-templates/

Thank you !

Post count: 200

Hi Vlad,

a custom template is not an option as we have used many different design templates already and don’t wish to lose that customization.
Is there a file that I can copy and paste in my child theme and then add the needed code?
Thanks!

p.s. We are using an older version of the theme and installing the library plugin wasn’t possible.

Post count: 18283

Hello !

Please point out where do you want to post your code so we can help you implement it in the right way. Provide a link to your website and point out exactly where do you want your buttons.

Thank you !

Post count: 200

Hi Vlad,

Thanks for your help!

I need to add this code (please note that XXXXXXXX will be replaced with a real Facebook appID) on post and product pages:

<div id=”fb-root”></div>
<script async defer crossorigin=”anonymous” src=”https://connect.facebook.net/bg_BG/sdk.js#xfbml=1&version=v3.3&appId=XXXXXXXXXXX&autoLogAppEvents=1″></script>

Code: https://www.dropbox.com/s/ky1m0a5zvgrpvt2/Facebook%20Like%20and%20Share%20buttons%20GD.jpg?dl=0

It should load these buttons: https://www.dropbox.com/s/x3b9mvdqois3iyj/Facebook%20Like%20and%20Share%20buttons%20GD-fronend.jpg?dl=0

There is further piece of code that should be added within the body tag, but I can take care of this myself.

I need the provided code and respectively Facebook button to appear on post and product pages. Please see the screenshots.

Post page example: https://www.dropbox.com/s/hoj2psbsmp4eqic/post%20page.jpg?dl=0

Product page example: https://www.dropbox.com/s/8223v1stpbua191/product%20page.jpg?dl=0

I’m using a child theme.

I really appreciate your support!

Thanks!

Post count: 18283

Hello !

You will have to paste the javascript code here: https://www.screencast.com/t/N05Tfodult and the other code you will have to insert it in your post template code wich can be found here: https://www.screencast.com/t/ZI7jnZMe

Thank you !

Post count: 200

I copied the single.php in the main folder of the child theme and tried to add the code everywhere like this: https://www.dropbox.com/s/fb62tu4vyxdladk/single-php.jpg?dl=0

Also added the second part to the code as adviced.

Unfortunately it doesn’t show up.

Post count: 200

Also tried to add the code to the loop-single-5.php like this: https://www.dropbox.com/s/nfexwps0y050xjw/demo123.jpg?dl=0 – without result

Post count: 18283

Hello !

Please check if the modifications do render on the frontend. Try writing a simple text like TEST or something in your file and see if that renders on you homepage. If it does not render then either you have the wrong template or your child theme is not properly set.

What theme version are you runing ?

Thank you !

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