Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
840 views
in Q2A Core by
reshown by
where would I add the code that facebook gave me to add messenger to the site?

fb suggest just after the <body> but there is no body tag in qa-theme.php

or is there a plug-in for this somewhere that I couldn't find?

Thank you
Q2A version: 1.8.3

1 Answer

+1 vote
by
edited by

You'll have to copy the body() function from qa-theme-base.php to the current theme you're using, and then make the necessary changes. Like the example below.


Edit

public function body()

{

    $this->output('<body');

    $this->body_tags();

    $this->output('>');

    $this->output('<!-- Load Facebook SDK for JavaScript -->

  <div id="fb-root"></div>

  <script>

window.fbAsyncInit = function() {

  FB.init({

xfbml            : true,

version          : \'v6.0\'

  });

};

(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 = \'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js\';

fjs.parentNode.insertBefore(js, fjs);

  }(document, \'script\', \'facebook-jssdk\'));</script>

  <!-- Your customer chat code -->

  <div class="fb-customerchat"

attribution=setup_tool

page_id="YOURPAGEID"

theme_color="#4267b2"

logged_in_greeting="YOUR GREETING."

logged_out_greeting="YOUR GREETING.">

  </div>">');

    $this->body_script();

    $this->body_header();

    $this->body_content();

    $this->body_footer();

    $this->body_hidden();

    $this->output('</body>');

}

by
thank you  so much :) it's almost working...with that code now it shows a
">
at the top of the screen...
it's this part that is causing it
</div>">');
*uggg*I do not understand javascript
by
I think you're supposed to add a link to your facebook code at the very beginning of the output, where it says: Load Facebook SDK for JavaScript.
In fact, at the moment it's just an open tag

<script src="<!-- Load Facebook SDK for JavaScript -->
by
Nevermind, that's actually a typo now that I look at it. You need to remove that open script part

<script src="
by
no...still showing "> above the header....
i really appreciate you trying to help me get this to work...
...