PageRenderTime 16ms CodeModel.GetById 9ms app.highlight 2ms RepoModel.GetById 2ms 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/**
21 * Output Post Comments
22 * 
23 * Outputs post comments on single blog posts. 
24 * If the Theme option is enabled to use Disqus 
25 * comments, then Disqus comment markup is output; 
26 * otherwise, the Theme comments template file is 
27 * output.
28 * 
29 * This function hooked into the micro_comments hook, 
30 * which is defined in /inc/hooks.php, and which fires
31 * in the content.php and content-single.php template
32 * files.
33 * 
34 * Template files: content.php, content-single.php
35 * 
36 * @link 	http://codex.wordpress.org/Function_Reference/_e		 			_e()
37 * @link 	http://codex.wordpress.org/Function_Reference/comments_template 	comments_template()
38 * @link 	http://codex.wordpress.org/Function_Reference/is_single 			is_single()
39 * @link 	http://codex.wordpress.org/Function_Reference/the_permalink			the_permalink()
40 * @link 	http://codex.wordpress.org/Function_Reference/the_title 			the_title()
41 * 
42 * @param	none
43 * @return	string	Comments markup
44 * 
45 * @since	Micro 1.0
46 * 
47 */
48function micro_attach_comments(){
49	if(is_single()):
50		global $post,$up_options;
51		
52		if( $up_options->disqus ): ?>
53		
54		<div id="disqus_comments">
55			
56			<script type="text/javascript">var disqus_url = "<?php the_permalink(); ?>"; var disqus_title ="<?php the_title(); ?>";</script>
57			<div class="post_box">
58				<div id="disqus_thread"></div>
59			</div>
60			<noscript><a href="http://disqus.com/forums/<?php echo $up_options->disqus; ?>/?url=ref"><?php _e("View the discussion thread","micro"); ?></a></noscript>
61		
62		</div>
63		
64		<?php else: ?>
65		<div class="comments"><?php comments_template('', true);?></div>
66		<?php endif;
67	endif;
68}
69// Hook micro_attach_comments() into micro_comments
70add_action('micro_comments','micro_attach_comments');
71
72/**
73 * Output custom comments list for pings
74 * 
75 * Callback: wp_list_comments() Pings
76 * 
77 * wp_list_comments() Callback function for 
78 * Pings (Trackbacks/Pingbacks)
79 * 
80 * Template file: comments.php
81 * 
82 * @link	http://codex.wordpress.org/Function_Reference/comment_author_link	Codex reference: comment_author_link()
83 * @link	http://codex.wordpress.org/Function_Reference/comment_class	Codex reference: comment_class()
84 * @link	http://codex.wordpress.org/Function_Reference/comment_ID	Codex reference: comment_ID()
85 * 
86 * @since	Micro 1.0
87 */
88function micro_comment_list_pings( $comment ) {
89	$GLOBALS['comment'] = $comment;
90?>
91	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"><?php echo comment_author_link(); ?></li>
92<?php }