Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1160538
    bartvanoers
    Participant

    Hey friends,

    I want to change the language of the Facebook Comments Plugin. I used this code:

    if ( ! function_exists( 'x_facebook_sdk' ) ) :
      function x_facebook_sdk() {
    
        require( X_FACEBOOK_COMMENTS_PATH . '/functions/options.php' ); ?>
    
        <div id="fb-root"></div>
    
        <script>
          window.fbAsyncInit = function() {
            FB.init({
              appId   : '<?php echo $x_facebook_comments_app_id; ?>',
              xfbml   : true,
              version : 'v2.1'
            });
          };
    
          (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/nl_NL/sdk.js";
             fjs.parentNode.insertBefore(js, fjs);
           }(document, 'script', 'facebook-jssdk'));
        </script>
    
      <?php }
    endif;

    found in this post, but it doesn’t work. I also made the adjustment in plugins/x-facebook-comments/functions/output.php but also no effect. When I check it in Safari/Chrome inspector it still says en_US instead of nl_NL.

    Any clues?

    #1160540
    bartvanoers
    Participant
    This reply has been marked as private.
    #1160588
    Thai
    Moderator

    Hi There,

    Please find this code under functions.php file:

    if ( ! function_exists( 'x_facebook_sdk' ) ) :
      function x_facebook_sdk() {
    
        require( X_FACEBOOK_COMMENTS_PATH . '/functions/options.php' ); ?>
    
        <div id="fb-root"></div>
    
        <script>
          window.fbAsyncInit = function() {
            FB.init({
              appId   : '<?php echo $x_facebook_comments_app_id; ?>',
              xfbml   : true,
              version : 'v2.1'
            });
          };
    
          (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/nl_NL/sdk.js";
             fjs.parentNode.insertBefore(js, fjs);
           }(document, 'script', 'facebook-jssdk'));
        </script>
    
      <?php }
    endif;

    And change to this:

    function x_facebook_sdk() {
    
        require( X_FACEBOOK_COMMENTS_PATH . '/functions/options.php' ); ?>
    
        <div id="fb-root"></div>
    
        <script>
          window.fbAsyncInit = function() {
            FB.init({
              appId   : '<?php echo $x_facebook_comments_app_id; ?>',
              xfbml   : true,
              version : 'v2.1'
            });
          };
    
          (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/nl_NL/sdk.js";
             fjs.parentNode.insertBefore(js, fjs);
           }(document, 'script', 'facebook-jssdk'));
        </script>
    
      <?php }

    Hope it helps 🙂

    #1160612
    bartvanoers
    Participant

    Thanks! But it doesn’t work.

    The site is now over here by the way.

    #1160858
    Rad
    Moderator

    Hi there,

    There are two instances of SDK declaration. One for EN and one for NL, and EN is loaded first ignoring the second one. Do you have other customizations that deal with Facebook API? Would you mind providing your FTP login credentials as well?

    Thanks!

    #1160874
    bartvanoers
    Participant
    This reply has been marked as private.
    #1161107
    Lely
    Moderator

    Hi There,

    Thank you for the admin credentials.
    I did check and even update your code to this:

    if ( ! function_exists( 'x_facebook_sdk' ) ) :
    function x_facebook_sdk() {
    
        require( X_FACEBOOK_COMMENTS_PATH . '/functions/options.php' ); ?>
    
        <div id="fb-root"></div>
    
        <script>
          window.fbAsyncInit = function() {
            FB.init({
              appId   : '<?php echo $x_facebook_comments_app_id; ?>',
              xfbml   : true,
              version : 'v2.1'
            });
          };
    
          (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/nl_NL/sdk.js";
             fjs.parentNode.insertBefore(js, fjs);
           }(document, 'script', 'facebook-jssdk'));
        </script>
    
      <?php   }
      endif;

    That same code is working on my test site. Then I found out that you have Simple Share Buttons Adder plugin too. This plugin might be loading facebook SDK too. Please try disabling this and then check if it works.

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