Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #878974
    Ryandm1983
    Participant

    Hi Team X

    Ive recently installed the X child theme as advised by research done on the forum. This is so i can edit the functions.php file without affecting the main theme. However as i attempted to make edits and save i now can not access the domain through a browser at all. I added a single letter, just to test if it would save & now site is down !

    This is the error i get.
    “Parse error: syntax error, unexpected ‘<‘ in /usr/www/users/vayadpumft/genesishotel.vayadata.co.za/wp-content/themes/x-child/functions.php on line 26”

    Hoping & praying for a quick solution – thank you!

    #879584
    Ryandm1983
    Participant

    Right so, i figured out that the syntax error was from the JavaScript SDK code i added from facebook.
    I replaced the functions.php file via ftp and site is back.

    So now, i’m pasting the Facebook code exactly as expressed via the forum & Facebook, but the code is not working ?

    I suppose the question now is why cant we integrate Facebook widget code successfully ?

    #879656
    Thai
    Moderator

    Hi There,

    Please try with this code, add it under functions.php file locate in your child theme:

    add_action( 'x_before_site_begin', 'x_facebook_sdk' );
    function x_facebook_sdk(){
    	?>
    	<div id="fb-root"></div>
    	<script>(function(d, s, id) {
    	  var js, fjs = d.getElementsByTagName(s)[0];
    	  if (d.getElementById(id)) return;
    	  js = d.createElement(s); js.id = id;
    	  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.6&appId=490866727757684";
    	  fjs.parentNode.insertBefore(js, fjs);
    	}(document, 'script', 'facebook-jssdk'));</script>
    	<?php
    }

    Hope it helps 🙂

    #880726
    Ryandm1983
    Participant

    Thanks Thai

    Ummm, didnt seem to work, or at least the page ran really slowly. Strange enough when i added the SDK above the html all in the same text element it worked.

    Thanks for your help.

    #881431
    Paul R
    Moderator

    Hi,

    Facebook recommends inserting it directly after the opening <body> tag thus it is inserted in x_before_site_begin.

    Kindly review this link – https://developers.facebook.com/docs/javascript/quickstart/v2.6

    Thanks

    #889484
    Ryandm1983
    Participant

    Thanks so much !

    #889904
    Darshana
    Moderator

    Glad we were able to help 🙂

  • <script> jQuery(function($){ $("#no-reply-878974 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>