Advertisement
Guest User

Amer Kawar

a guest
Oct 31st, 2009
601
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.97 KB | None | 0 0
  1. <?php
  2. /*
  3.  * File: Fixed 'comments.php' file
  4.  *
  5.  * Article: HOW TO: Build a XHTML Valid Wordpress Blog with DISQUS Plugin
  6.  * URL: http://blog.thoughtpick.com/2009/10/how-to-build-xhtml-valid-wordpress.html
  7.  *
  8.  */
  9. ?><?php
  10.     global $dsq_response, $dsq_version;
  11. ?>
  12.  
  13. <div id="disqus_thread">
  14.     <div id="dsq-content">
  15.         <?php if(count($dsq_response['posts']) > 0): ?> <ul id="dsq-comments"> <?php endif; ?>
  16. <?php foreach ( $dsq_response['posts'] as $comment ) : ?>
  17.             <li id="dsq-comment-<?php echo $comment['id']; ?>">
  18.                                 <div id="comment-<?php echo $comment['id']; ?>"></div>
  19.                 <div id="dsq-comment-header-<?php echo $comment['id']; ?>" class="dsq-comment-header">
  20.                     <cite id="dsq-cite-<?php echo $comment['id']; ?>">
  21. <?php if($comment['user']['url']) : ?>
  22.                         <a id="dsq-author-user-<?php echo $comment['id']; ?>" href="<?php echo $comment['user']['url']; ?>" target="_blank" rel="nofollow"><?php echo $comment['user']['display_name']; ?></a>
  23. <?php else : ?>
  24.                         <span id="dsq-author-user-<?php echo $comment['id']; ?>"><?php echo $comment['user']['display_name']; ?></span>
  25. <?php endif; ?>
  26.                     </cite>
  27.                 </div>
  28.                 <div id="dsq-comment-body-<?php echo $comment['id']; ?>" class="dsq-comment-body">
  29.                     <div id="dsq-comment-message-<?php echo $comment['id']; ?>" class="dsq-comment-message"><?php echo str_ireplace(array("<br>", " & "), array("<br />", " &amp; "), $comment['message']); ?></div>
  30.                 </div>
  31.             </li>
  32. <?php endforeach; ?>
  33.         <?php if(count($dsq_response['posts']) > 0): ?> </ul> <?php endif; ?>
  34.     </div>
  35. </div>
  36.  
  37. <a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
  38.  
  39. <script type="text/javascript" charset="utf-8">
  40.     var disqus_url = '<?php echo get_permalink(); ?> ';
  41.     var disqus_container_id = 'disqus_thread';
  42.     var facebookXdReceiverPath = '<?php echo DSQ_PLUGIN_URL . '/xd_receiver.htm' ?>';
  43. </script>
  44.  
  45. <script type="text/javascript" charset="utf-8">
  46.     var DsqLocal = {
  47.         'trackbacks': [
  48. <?php
  49.     $count = 0;
  50.     foreach ($comments as $comment) {
  51.         $comment_type = get_comment_type();
  52.         if ( $comment_type != 'comment' ) {
  53.             if( $count ) { echo ','; }
  54. ?>
  55.             {
  56.                 'author_name':  '<?php echo htmlspecialchars(get_comment_author(), ENT_QUOTES); ?>',
  57.                 'author_url':   '<?php echo htmlspecialchars(get_comment_author_url(), ENT_QUOTES); ?>',
  58.                 'date':         '<?php comment_date('m/d/Y h:i A'); ?>',
  59.                 'excerpt':      '<?php echo str_replace(array("\r\n", "\n", "\r"), '<br />', htmlspecialchars(get_comment_excerpt(), ENT_QUOTES)); ?>',
  60.                 'type':         '<?php echo $comment_type; ?>'
  61.             }
  62. <?php
  63.             $count++;
  64.         }
  65.     }
  66. ?>
  67.         ],
  68.         'trackback_url': '<?php trackback_url(); ?>'
  69.     };
  70. </script>
  71.  
  72. <script type="text/javascript" charset="utf-8" src="http://<?php echo strtolower(get_option('disqus_forum_url')); ?>.<?php echo DISQUS_DOMAIN; ?>/disqus.js?v=2.0&amp;slug=<?php echo $dsq_response['thread_slug']; ?>&amp;pname=wordpress&amp;pver=<?php echo $dsq_version; ?>"></script>
  73.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement