Announcement

Collapse
No announcement yet.

is (static HTML) suitable to insert the Facebook comment plugin to every forum thread

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • is (static HTML) suitable to insert the Facebook comment plugin to every forum thread

    Hi
    my vb version is 5.2.5 ,
    I want to insert the Facebook comment plugin to every forum thread , Facebook gave me 2 codes blocks :
    1- Include the JavaScript SDK on your page once, ideally right after the opening <body> tag
    2- Place this code wherever you want the plugin to appear on your page.
    I Tried to add 2 static HTML and put the 2 code blocks in it ,
    but it is static , not change to every thread ,
    what is the correct method to add facebook 2 code blocks As mentioned above ?
    thanks in advance
    Last edited by Mark.B; Mon 16 Jan '17, 12:51pm.

  • #2
    Yes you can do it using one HTML module but the topic URL needs to be dynamic and not hardcoded.

    Try pasting this in an HTML module:

    HTML Code:
    <div class="fb-comments" data-href="" data-numposts="5"></div>
    <script>
    (function() {
        var topicUrl = location.protocol + '//' + location.host + location.pathname.replace(/\/page[0-9]*/, ''); //get the topic url from the current page url excluding the page number and querystrings
        document.querySelector('.fb-comments').setAttribute('data-href', topicUrl); //set the url in the fb-comments div dynamically
    })();
    </script>
    <!-- Insert Facebook Javascript SDK here -->

    GIPHY for vB5 AutoLinker Auto-Create Flag Report Topic Social Icons in Postbit Clear Cache Cron DragDrop Upload Topic AJAX AutoUpdate Custom Avatars Selector Stop Links in Posts...and more!

    Comment


    • #3
      thank you very much for reply
      I did it by add the code to the style in contententry template ,and it works well,
      what is the best solution from you experience ???(by the html module As you mentioned above or in the style ?)
      thank you very very much
      Last edited by Mark.B; Mon 16 Jan '17, 12:52pm.

      Comment


      • #4
        Did you mean you edited the contententry template? Editing existing vB templates is not recommended as it may get overwritten or cause template merge conflicts that you have to resolve every time you upgrade. If you use an HTML module or create a template hook to implement the FB comment plugin, then you don't have to worry about template issues in the future.

        GIPHY for vB5 AutoLinker Auto-Create Flag Report Topic Social Icons in Postbit Clear Cache Cron DragDrop Upload Topic AJAX AutoUpdate Custom Avatars Selector Stop Links in Posts...and more!

        Comment


        • #5
          thank you for reply ,
          yes I mean editing contententry template , to fit not just facebook connect plugin , but also for like and share posts >>etc,
          because my language is bad , please suggest to vBulletin team make enough options to connect with facebook with all its tools like share , save , like buttons to every thing in the vb application (to forum threads >>etc ) ,
          thank you very much

          Comment

          Related Topics

          Collapse

          Working...
          X