WordPress.org

Forums

Disqus Comment System
override disqus_identifier (3 posts)

  1. blg002
    Member
    Posted 2 years ago #

    wondering if there is a good way to override the disqus_identifier value. I'm porting my blog into wordpress and in my old site I had some custom identifiers

    http://wordpress.org/extend/plugins/disqus-comment-system/

  2. simspacetn
    Member
    Posted 2 years ago #

    I had to get some band reviews that were already in Disqus from from my old site into my new WordPress band site. I only wanted the reviews on our home page so here's what I did...

    I looked at the code on my old site and grabbed the disqus_identifier value from there.

    I went to add a custom field to the home page. To my surprise in the list there was already a custom field there named dsq_thread_id. So I added that custom field and gave it the disqus_identifier value from my old site.

    I'm new to WordPress and PHP so this is probably bad a bad idea, but I needed to get this done, so I edited the Disqus plugin's comment.php by adding this code after all the var initialization...

    <?php if ( get_post_meta($post->ID, 'dsq_thread_id', true) ) : ?>
            disqus_identifier = '<?php echo get_post_meta($post->ID, 'dsq_thread_id', true); ?>';
        <?php endif; ?>

    BAAAMMM! Worked the first time...

    If you have any ideas about how to get this to work without changing the Disqus plugin code base, that would rock. I need to take a step back and really think this over after the new site is released in a couple of day.

    -Chris
    http://www.u2act.com

  3. simspacetn
    Member
    Posted 2 years ago #

    Okay... that was a bad idea... sort of...

    The dsq_thread_id is a reserved field. It was overwritten and my reviews stopped showing up.

    So I defined and added a custom field named "dsq_identifier" and gave it the disqus_identifier value from my old site.

    I then corrected the Disqus plugin's comment.php as follows...

    <?php if ( get_post_meta($post->ID, 'dsq_thread_id', true) ) : ?>
            disqus_identifier = '<?php echo get_post_meta($post->ID, 'dsq_identifier', true); ?>';
    <?php endif; ?>

    One other thing I forgot to mention was that I modified my custom template which used by several pages. I only want to display the review comments on our home page which has the custom field named "dsq_identifier." Here's that code...

    <?php if ( get_post_meta($post->ID, 'dsq_identifier', true) ) : ?>
        <?php comments_template(); ?> 
    <?php endif; ?>

    -Chris
    http://www.u2act.com

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Disqus Comment System
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.