Pulling Permalink Into Facebook Comment Code
-
I use a Facebook Like button and comments on my site Unreality House by inserting the comment block code into the footer widget. The Like button works fine, but currently the comments display the same all over the site. I’m aware that this is because I have a fixed URL in the data-href parameter (see code below). I’m aware that I need to replace that with code to pull the individual post permalink. Here’s my problem: no code that I’ve tried works. I’ve tried putting <?php the_permalink(); ?> and <?php get_permalink(); ?> and ‘, get_permalink() ,’ and ‘, the_permalink() ,’ in the double quotes, but in every instance the comment block on the site says that “https://invalid-invalid is unreachable.” I’ve been poring through help forums for an hour, and I can’t find anything that would explain why that permalink code, which seems to work for everybody else, isn’t working for me. Any ideas?
<div id=”fb-root”></div>
<script>(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/en_US/all.js#xfbml=1”;
fjs.parentNode.insertBefore(js, fjs);
}(document, ‘script’, ‘facebook-jssdk’));</script>
<div class=”fb-comments” data-href=”https://www.unrealityhouse.com” data-num-posts=”10″ data-width=”500″></div>
- The topic ‘Pulling Permalink Into Facebook Comment Code’ is closed to new replies.