WordPress.org

Ready to get started?Download WordPress

Forums

Inserting Facebook 'like' button code - new Child Theme header.php? (5 posts)

  1. Paulc66
    Member
    Posted 8 months ago #

    Hello,

    I have created a Child Theme but all I have in it at present is a style.css file.

    I am trying to embed Facebook ‘Like’ buttons in my site and to do so Facebook is telling me to

    ‘Include the JavaScript SDK on your page once, ideally right after the opening <body> tag.’

    To do this do I :

    • Go to the File Manager for my site on my hosting service control panel

    • Copy the contents of my header. php file in my Parent Theme

    • Create a new header.php file in my Child Theme Folder and paste the copied contents into this folder

    • Then, in my wordpress dashboard editor, insert the code from facebook after the opening <body> tag in my new Child Theme header.php file ????

    In my header.php file I can see this ‘<body <?php body_class(); ?>>’ near the top of the page but cannot find any closing tag </body>.

    Where should I paste the code?

    Really appreciate your help, Thanks.

  2. WPyogi
    Volunteer Moderator
    Posted 8 months ago #

    The closing body tag is in the footer.php file.

  3. Paulc66
    Member
    Posted 8 months ago #

    Thanks WPyogi,

    So to follow facebooks instructions- ‘Include the JavaScript SDK on your page once, ideally right after the opening <body> tag.’

    Are the following steps right:

    Go to the File Manager for my site on my hosting service control panel

    • Copy the contents of my header. php file in my Parent Theme

    • Create a new header.php file in my Child Theme Folder and paste the copied contents into this folder

    • Then, in my wordpress dashboard editor, insert the code from facebook after the opening <body> tag in my new Child Theme header.php file ????

  4. WPyogi
    Volunteer Moderator
    Posted 8 months ago #

    Yep, that sounds generally correct, though the exact place to put the code may depend on your theme/site.

    Are you using a plugin for this?

  5. Paulc66
    Member
    Posted 8 months ago #

    Not using a plugin WPyogi, have done it by creating child header php and pasting in code after opening body tag and seems to have worked.

    Thanks alot for your help

Reply

You must log in to post.

About this Topic

Tags

No tags yet.