Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * File: Fixed 'comments.php' file
- *
- * Article: HOW TO: Build a XHTML Valid Wordpress Blog with DISQUS Plugin
- * URL: http://blog.thoughtpick.com/2009/10/how-to-build-xhtml-valid-wordpress.html
- *
- */
- ?><?php
- global $dsq_response, $dsq_version;
- ?>
- <div id="disqus_thread">
- <div id="dsq-content">
- <?php if(count($dsq_response['posts']) > 0): ?> <ul id="dsq-comments"> <?php endif; ?>
- <?php foreach ( $dsq_response['posts'] as $comment ) : ?>
- <li id="dsq-comment-<?php echo $comment['id']; ?>">
- <div id="comment-<?php echo $comment['id']; ?>"></div>
- <div id="dsq-comment-header-<?php echo $comment['id']; ?>" class="dsq-comment-header">
- <cite id="dsq-cite-<?php echo $comment['id']; ?>">
- <?php if($comment['user']['url']) : ?>
- <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>
- <?php else : ?>
- <span id="dsq-author-user-<?php echo $comment['id']; ?>"><?php echo $comment['user']['display_name']; ?></span>
- <?php endif; ?>
- </cite>
- </div>
- <div id="dsq-comment-body-<?php echo $comment['id']; ?>" class="dsq-comment-body">
- <div id="dsq-comment-message-<?php echo $comment['id']; ?>" class="dsq-comment-message"><?php echo str_ireplace(array("<br>", " & "), array("<br />", " & "), $comment['message']); ?></div>
- </div>
- </li>
- <?php endforeach; ?>
- <?php if(count($dsq_response['posts']) > 0): ?> </ul> <?php endif; ?>
- </div>
- </div>
- <a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
- <script type="text/javascript" charset="utf-8">
- var disqus_url = '<?php echo get_permalink(); ?> ';
- var disqus_container_id = 'disqus_thread';
- var facebookXdReceiverPath = '<?php echo DSQ_PLUGIN_URL . '/xd_receiver.htm' ?>';
- </script>
- <script type="text/javascript" charset="utf-8">
- var DsqLocal = {
- 'trackbacks': [
- <?php
- $count = 0;
- foreach ($comments as $comment) {
- $comment_type = get_comment_type();
- if ( $comment_type != 'comment' ) {
- if( $count ) { echo ','; }
- ?>
- {
- 'author_name': '<?php echo htmlspecialchars(get_comment_author(), ENT_QUOTES); ?>',
- 'author_url': '<?php echo htmlspecialchars(get_comment_author_url(), ENT_QUOTES); ?>',
- 'date': '<?php comment_date('m/d/Y h:i A'); ?>',
- 'excerpt': '<?php echo str_replace(array("\r\n", "\n", "\r"), '<br />', htmlspecialchars(get_comment_excerpt(), ENT_QUOTES)); ?>',
- 'type': '<?php echo $comment_type; ?>'
- }
- <?php
- $count++;
- }
- }
- ?>
- ],
- 'trackback_url': '<?php trackback_url(); ?>'
- };
- </script>
- <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&slug=<?php echo $dsq_response['thread_slug']; ?>&pname=wordpress&pver=<?php echo $dsq_version; ?>"></script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement