PageRenderTime 46ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/inc/extensions/comments-extensions.php

https://github.com/envex/Micro-Theme
PHP | 92 lines | 23 code | 7 blank | 62 comment | 2 complexity | 3ac2bbc2d74da2f16f83ab8e0ae1f76d MD5 | raw file
  1. <?php
  2. /**
  3. * Theme Comments Extension Functions file
  4. *
  5. * The /inc/extensions/comments-extensions.php file defines
  6. * all of the Theme's callback functions that hook into
  7. * Theme custom and WordPress action/filter hooks in comments.php
  8. * - micro_comments
  9. * - wp_list_comments (callback)
  10. *
  11. * @link http://codex.wordpress.org/Function_Reference/add_action add_action()
  12. *
  13. * @package Micro
  14. * @copyright Copyright (c) 2011, UpThemes
  15. * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License, v2 (or newer)
  16. *
  17. * @since Micro 1.0
  18. */
  19. /**
  20. * Output Post Comments
  21. *
  22. * Outputs post comments on single blog posts.
  23. * If the Theme option is enabled to use Disqus
  24. * comments, then Disqus comment markup is output;
  25. * otherwise, the Theme comments template file is
  26. * output.
  27. *
  28. * This function hooked into the micro_comments hook,
  29. * which is defined in /inc/hooks.php, and which fires
  30. * in the content.php and content-single.php template
  31. * files.
  32. *
  33. * Template files: content.php, content-single.php
  34. *
  35. * @link http://codex.wordpress.org/Function_Reference/_e _e()
  36. * @link http://codex.wordpress.org/Function_Reference/comments_template comments_template()
  37. * @link http://codex.wordpress.org/Function_Reference/is_single is_single()
  38. * @link http://codex.wordpress.org/Function_Reference/the_permalink the_permalink()
  39. * @link http://codex.wordpress.org/Function_Reference/the_title the_title()
  40. *
  41. * @param none
  42. * @return string Comments markup
  43. *
  44. * @since Micro 1.0
  45. *
  46. */
  47. function micro_attach_comments(){
  48. if(is_single()):
  49. global $post,$up_options;
  50. if( $up_options->disqus ): ?>
  51. <div id="disqus_comments">
  52. <script type="text/javascript">var disqus_url = "<?php the_permalink(); ?>"; var disqus_title ="<?php the_title(); ?>";</script>
  53. <div class="post_box">
  54. <div id="disqus_thread"></div>
  55. </div>
  56. <noscript><a href="http://disqus.com/forums/<?php echo $up_options->disqus; ?>/?url=ref"><?php _e("View the discussion thread","micro"); ?></a></noscript>
  57. </div>
  58. <?php else: ?>
  59. <div class="comments"><?php comments_template('', true);?></div>
  60. <?php endif;
  61. endif;
  62. }
  63. // Hook micro_attach_comments() into micro_comments
  64. add_action('micro_comments','micro_attach_comments');
  65. /**
  66. * Output custom comments list for pings
  67. *
  68. * Callback: wp_list_comments() Pings
  69. *
  70. * wp_list_comments() Callback function for
  71. * Pings (Trackbacks/Pingbacks)
  72. *
  73. * Template file: comments.php
  74. *
  75. * @link http://codex.wordpress.org/Function_Reference/comment_author_link Codex reference: comment_author_link()
  76. * @link http://codex.wordpress.org/Function_Reference/comment_class Codex reference: comment_class()
  77. * @link http://codex.wordpress.org/Function_Reference/comment_ID Codex reference: comment_ID()
  78. *
  79. * @since Micro 1.0
  80. */
  81. function micro_comment_list_pings( $comment ) {
  82. $GLOBALS['comment'] = $comment;
  83. ?>
  84. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"><?php echo comment_author_link(); ?></li>
  85. <?php }