I have several pages that are all part of the same topic, and I would like them to use the same comment thread on Disqus. I am using the following code to pull the custom identifier from a custom field:
<?php
//Attempt to get identifier
$disqus = get_post_meta($post->ID, 'disqusid', true);
//if isset & not blank else use $post->ID
$disqus = (!empty($disqus)) ? $disqus : $post->ID;
?>
<script type="text/javascript">
var disqus_identifier="<?=$disqus?>";
</script>
The code is displaying the value from the custom field correctly, however, the Disqus plugin is still using the page ID as the identifier when I inspect the page code. Meaning each page still uses its own comment thread.
I have tried placing the code in several different places: just before the comments_template(); code, in header.php in various places (before/after wp_head), and in footer.php in various places (before/after wp_footer).
Everything I’ve read makes it sound as simple as adding the identifier code before the embed.js call for Disqus. I feel like I may be missing something special that needs to be done. Is it possible something else is interfering with it? Everything else is working as expected.
Disqus WordPress Plugin: http://wordpress.org/extend/plugins/disqus-comment-system/
The site I’m working on isn’t live until this issue is fixed, but I can set it live if viewing the whole site code will help.