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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abdallah1991
    New Member
    • Jan 2017
    • 4
    • 5.2.x

    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.
  • glennrocksvb
    Former vBulletin Developer
    • Mar 2011
    • 3955
    • 5.7.X

    #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 -->

    Flag Icon Postbit Insert GIPHY Impersonate User INITIALS AVATAR Better Name Card Quote Selected Text Collapsed PM Post Footer Translate Stop Links in Posts +MORE!

    Comment

    • abdallah1991
      New Member
      • Jan 2017
      • 4
      • 5.2.x

      #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

      • glennrocksvb
        Former vBulletin Developer
        • Mar 2011
        • 3955
        • 5.7.X

        #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.

        Flag Icon Postbit Insert GIPHY Impersonate User INITIALS AVATAR Better Name Card Quote Selected Text Collapsed PM Post Footer Translate Stop Links in Posts +MORE!

        Comment

        • abdallah1991
          New Member
          • Jan 2017
          • 4
          • 5.2.x

          #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...
          😀
          😂
          🥰
          😘
          🤢
          😎
          😞
          😡
          👍
          👎