Viewing 15 replies - 1 through 15 (of 15 total)
  • Hi,

    I have the same issue. I went from http://supersnelgezond.nl to https://supersnelgezond.nl. Is there a way to get the “old” Facebook comments back?

    Thank you,

    Carlo

    Hi silgringo,

    This is what I did in the end.

    I added the facebook comments without a plugin, like mentioned here: http://ryanbradley.com/blog/how-to-install-facebook-comments-on-wordpress-site

    That does not solve the issue, but now we are ready to fix it.

    This code places the facebook comments box:

    <div class="fb-comments" data-href="<?php the_permalink(); ?>" data-width="100%" data-numposts="10" data-order-by="social" data-colorscheme="light"></div>

    The <?php the_permalink(); ?> prints current URL including the https (once you migrated to https).

    I have replaced that part by echo-ing the http URL and the current slug. That fixed it, at least if thought. I had all my all comments back, but when people started to comment to new posts it went wrong. I did not see those comments appear in my Facebook Moderation Tool. They seemed to be hanging out there in space. So I altered the code in such a way that it uses the https URL for new posts.

    <div class="fb-comments" data-href="<?php
    $postid = get_the_ID();
    
    if ($postid < 8047) {
        echo "http://supersnelgezond.nl/" . $post->post_name;
    }else{
        the_permalink();
    }
    ?>/" data-width="100%" data-numposts="10" data-order-by="social" data-colorscheme="light"></div>

    If you implement this option please adjust the post id number. This should match the post id of your first new post using https.

    Also change the http URL to your own URL.

    You can place the code on the first line of your comments.php file of your theme or (even better) create a comments.php in your child theme with the following code:

    <div class="fb-comments" data-href="<?php
    $postid = get_the_ID();
    
    if ($postid < 8047) {
        echo "http://supersnelgezond.nl/" . $post->post_name;
    }else{
        the_permalink();
    }
    ?>/" data-width="100%" data-numposts="10" data-order-by="social" data-colorscheme="light"></div>
    
    <?php include '/wp-content/themes/Avada/comments.php'?>

    Please make sure to update the last line to point to your Parrent Theme comments.php

    PS It works as far as I can tell. If somebody knows of a reason why you should not to solve it like this, please let me know. Hopefully you will have the better solution as well 😉

    PS found 2 times a slash to much (once at the end of Facebook comment part and one at the include), this is my current working version of the code:

    <br/>
    <div class="fb-comments" data-href="<?php
    $postid = get_the_ID();
    
    if ($postid < 8000) {
        echo "http://supersnelgezond.nl/" . $post->post_name;
    }else{
        the_permalink();
    }
    ?>" data-width="100%" data-numposts="10" data-order-by="social" data-colorscheme="light"></div>
    
    <?php include 'wp-content/themes/Avada/comments.php'?>

    My apologies, I was missing one slash for the “old” posts

    <br/>
    <div class="fb-comments" data-href="<?php
    $postid = get_the_ID();
    
    if ($postid < 8000) {
        echo "http://supersnelgezond.nl/" . $post->post_name . "/";
    }else{
        the_permalink();
    }
    ?>" data-width="100%" data-numposts="10" data-order-by="social" data-colorscheme="light"></div>
    Thread Starter silgringo

    (@silgringo)

    I will certainly have to give this a try when I got some free time. Says the guy still working at 9:30. Thank you so much for taking the time to post this jazzmofo. You’re the best!

    I’ll let yo know how it turns out.

    Thread Starter silgringo

    (@silgringo)

    I don’t know if I got something wrong, but now it just posts new comments to all post and the old comments are still not there. I added this:

    <div class="fb-comments" data-href="<?php
    $postid = get_the_ID();
    
    if ($postid < 4006) {
        echo "http://www.freewheelings.com/" .  $post->post_name . "/";
    }else{
        the_permalink();
    }
    ?>" data-width="100%" data-numposts="10" data-order-by="social" data-colorscheme="light"></div>
    jazzmofo

    (@jazzmofo)

    I double checked and compared the last code I posted to the code I’m using on my website right now. It is the same:

    <br/>
    <div class="fb-comments" data-href="<?php
    $postid = get_the_ID();
    
    if ($postid < 8000) {
        echo "http://supersnelgezond.nl/" . $post->post_name . "/";
    }else{
        the_permalink();
    }
    ?>" data-width="100%" data-numposts="10" data-order-by="social" data-colorscheme="light"></div>

    If you do see the new posts, it means that the “else” part of the code is working but the

    echo "http://supersnelgezond.nl/" . $post->post_name . "/";

    Is not writing the http://supersnelgezond.nl/post-slug/ (where “post-slug” should be the slug of that post you are on.

    I have honestly no idea why that does not work for you. Sorry, maybe somebody else can help?

    I know this is a old topic but i want to share working solution of it,
    Using the approach used by @jazzmofo i found that why it is not working for others , problem is in this line
    echo “http://supersnelgezond.nl/&#8221; . $post->post_name . “/”;
    as this site is using permalink structure of site.com/postname so it will only work if any one is using same permalink structure, so i alter the code as:-

    <?php
    $permalink = get_permalink();
    $find = array( 'https://' );
    $replace = 'http://';
    $output = str_replace( $find, $replace, $permalink );
    ?>
    <div class="fb-comments" data-href="<?php
    $postid = get_the_ID();
    
    if ($postid < 44133) {
        echo $output;
    }else{
        the_permalink();
    }
    
    ?>" data-width="100%" data-numposts="10" data-order-by="social" data-colorscheme="light"></div>

    No need to add your site link as this code will get permalink , it will replace https with http and yahooooooo.
    check it and see the magic 🙂

    Note:- Do change post ID number to yours. it will be id of first post you published after changing your site to https.

    Good thinking 🙂 And very nice of you to post the solution so others can benefit!

    Just trying to save others day 🙂

    @immortal is there a way to know from which post/page ID was the change to https? I did the change 4-5 months ago and this started going on recently?

    Maybe it helps to check the date of the SSL certificate and use that to find the related post?

    yes, good point.

    Let me elaborate-My situation is the following, client uses fb comments plugin only on pages (no posts on website). All the comments disappeared from the website already once and now after ssl installation again several months later.

    I have a problem because hundreds of comments are missing and new ones are again started to be posted.

    Any idea how to solve this or someone willing to help out one on one?

    Pages have post-dates too and they use the post ID as well. I would find the date of the switch to SSL using the certificate, sort the pages by date in the WP dashboard and find the first page posted after that date of the switch. Click edit page and you’ll find the post ID in the URL.

    Hello

    (@themophiles)

    It’s not working 🙁 I tried

    Please help.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Comments Missing After SSL Upgrade’ is closed to new replies.