Example #1
0
 protected static function get_comments_tree($comments)
 {
     $tree = array();
     if (!empty($comments)) {
         $comments_by_id = array();
         foreach ($comments as $comment) {
             $comments_by_id[$comment->comment_ID] = $comment;
         }
         ob_start();
         $wp_list_comments_args = array();
         wp_list_comments(apply_filters('wpak_comments_list_args', $wp_list_comments_args), $comments);
         $comments_list = ob_get_contents();
         ob_end_clean();
         //TODO : find another way to retrieve depths and ids than parsing the html (which can change!!!)
         $depths_found = preg_match_all('/depth-(\\d+)/', $comments_list, $matches_depths);
         $ids_found = preg_match_all('/id="comment-(\\d+)"/', $comments_list, $matches_ids);
         if (!empty($depths_found) && !empty($ids_found)) {
             foreach ($matches_depths[1] as $k => $depth) {
                 $comment_id = $matches_ids[1][$k];
                 $tree[$comment_id] = array('id' => $comment_id, 'depth' => (int) $depth, 'comment' => $comments_by_id[$comment_id]);
             }
         }
     }
     return $tree;
 }
 public function list_comments()
 {
     // Prepare wp_list_comments args
     //comment callback function
     if ('' === $this->options->get('cgb_comment_adjust') && function_exists($this->options->get('cgb_comment_adjust'))) {
         $args['callback'] = $this->options->get('cgb_comment_callback');
     } else {
         $args['callback'] = array(&$this, 'show_comment_html');
     }
     //correct order of top level comments
     if ('default' !== $this->options->get('cgb_clist_order')) {
         $args['reverse_top_level'] = false;
     }
     //correct order of child comments
     if ('desc' === $this->options->get('cgb_clist_child_order')) {
         $args['reverse_children'] = true;
     } elseif ('asc' === $this->options->get('cgb_clist_child_order')) {
         $args['reverse_children'] = false;
     }
     //change child order if top level order is desc due to array_reverse
     if ('desc' === $this->options->get('cgb_clist_order')) {
         $args['reverse_children'] = isset($args['reverse_children']) ? !$args['reverse_children'] : true;
     }
     // Print comments
     wp_list_comments($args);
 }
function wpc_heartbeat_response($response, $data)
{
    if (isset($data['wpc_comment_update'])) {
        global $wpdb;
        //get the newest comment-timestamp:
        // (we don't have to go to the DB for this every time, post_meta gets cached and updated only when the records get updated)
        $last_commented = get_post_meta($data['wpc_comment_update']['post_id'], '_wpc_comment_timestamp', true);
        //check the timestamp of our last known version versus the one in the heartbeat:
        if ($data['wpc_comment_update']['timestamp'] != $last_commented) {
            // We have data with our handle and a new comment! lets respond with something...
            // Get comments from the old timestamp up and post_id = $data['post_id'];
            $time = date('Y-m-d H:i:s', $last_commented);
            $post_id = $data['wpc_comment_update']['post_id'];
            //Query the new comments for this post that have been posted since:
            $_comments = $wpdb->get_results($wpdb->prepare("\n\t \t\t\t\t\tSELECT * \n\t \t\t\t\t\tFROM {$wpdb->comments} \n\t \t\t\t\t\tWHERE comment_post_ID = {$post_id} \n\t \t\t\t\t\tAND comment_date >= '{$time}' \n\n\t \t\t\t\t "));
            //Now, output the newest comments in html:
            ob_start();
            wp_list_comments(array('style' => 'ol', 'short_ping' => true, 'avatar_size' => 74), $_comments);
            //get the output buffer and clean it:
            $html = ob_get_clean();
            //then add it to the response object we're sending back
            //including the updated timestamp.
            $response['wpc_comment_update'] = array('timestamp' => $last_commented, 'html' => $html);
        }
    }
    return $response;
}
 public function get_comments()
 {
     if (isset($_GET['post'])) {
         $comments = get_comments(array('post_id' => intval($_GET['post']), 'status' => 'approve'));
         wp_list_comments(array('style' => 'ol', 'callback' => 'dwqa_question_comment_callback'), $comments);
     }
     exit(0);
 }
 public function show()
 {
     global $post;
     if (post_password_required($post)) {
         return;
     }
     echo '<ul class="commentlist">';
     wp_list_comments(array("callback" => array(&$this, "format"), "walker" => new Walker_Comment_PE()));
     echo '</ul>';
 }
 /**
  * @ticket 14041
  */
 function test_has_children()
 {
     $comment_parent = self::factory()->comment->create(array('comment_post_ID' => $this->post_id));
     $comment_child = self::factory()->comment->create(array('comment_post_ID' => $this->post_id, 'comment_parent' => $comment_parent));
     $comment_parent = get_comment($comment_parent);
     $comment_child = get_comment($comment_child);
     $comment_walker = new Walker_Comment();
     $comment_callback = new Comment_Callback_Test($this, $comment_walker);
     wp_list_comments(array('callback' => array($comment_callback, 'comment'), 'walker' => $comment_walker, 'echo' => false), array($comment_parent, $comment_child));
     wp_list_comments(array('callback' => array($comment_callback, 'comment'), 'walker' => $comment_walker, 'echo' => false), array($comment_child, $comment_parent));
 }
Example #7
0
 /**
  * Load Comments AJAX Hook
  */
 public function fruitframeLoadCommentsHook()
 {
     $id = (int) $_POST['id'];
     $query = new WP_Query(array('post_type' => 'post', 'p' => $id, 'post_status' => 'publish'));
     while ($query->have_posts()) {
         $query->the_post();
         $comments = get_comments(array('post_id' => get_the_ID(), 'orderby' => 'comment_date_gmt', 'order' => 'ASC', 'status' => 'approve'));
         wp_list_comments(array('callback' => 'fruitframe_comment'), $comments);
     }
     exit;
 }
    /**
     * Comments Rendering
     *
     * @package Customizr
     * @since Customizr 3.0
     */
    function tc_comment_list()
    {
        ?>

      		<ul class="commentlist">
      			<?php 
        wp_list_comments(array('callback' => array($this, 'tc_comment_callback'), 'style' => 'ul'));
        ?>
      		</ul><!-- .commentlist -->

    		<?php 
    }
Example #9
0
/**
 * Dispaly the list of comments.
 *
 * @since 4.0.0
 */
function cherry_comments_default_list()
{
    $defaults = array('style' => 'ol', 'type' => 'all', 'avatar_size' => 48, 'short_ping' => true, 'callback' => 'cherry_rewrite_comment_item');
    /**
     * Filter the defaults list arguments of comments.
     *
     * @since 4.0.0
     * @param array $defaults Defaults arguments.
     */
    $args = apply_filters('cherry_comment_list_args', $defaults);
    // Set argument 'echo' to the function 'wp_list_comments' for return result.
    $args = array_merge($args, array('echo' => false));
    printf('<%1$s class="comment-list">%2$s</%1$s>', tag_escape($args['style']), wp_list_comments($args));
}
Example #10
0
/**
 * List Comments
 *
 * @param TimberPost $post
 * @global integer $cpage
 * @global boolean $overridden_cpage
 */
function list_comments($post)
{
    global $cpage, $overridden_cpage;
    $cpage = $cpage ? $cpage : 1;
    $overridden_cpage = true;
    $commentsPerPage = (int) get_option('comments_per_page');
    $commentsOrder = get_option('comment_order');
    $defaultCommentsPage = get_option('default_comments_page');
    $commentPage = $cpage;
    $lastPage = ceil($post->comment_count / $commentsPerPage);
    if ($defaultCommentsPage == 'newest') {
        $commentPage = $lastPage - $cpage + 1;
    }
    wp_list_comments(array('callback' => 'render_comment'), get_comments(array('post_id' => $post->ID, 'number' => $commentsPerPage, 'offset' => (int) ($commentPage - 1) * $commentsPerPage, 'order' => $commentsOrder)));
}
Example #11
0
 function novusopress_comments_list(array $args = [], $echo = true)
 {
     $defaults = ['listEl' => 'ol', 'listId' => 'comment-list', 'listClass' => 'comment-list list-unstyled', 'callback' => 'novusopress_comment', 'endCallback' => 'novusopress_comment_end', 'indent' => 5, 'tab' => '    '];
     $args = wp_parse_args($args, $defaults);
     extract($args, EXTR_SKIP);
     $tabs = str_repeat($tab, $indent);
     $output = [];
     $output[] = sprintf('%s<%s id="%s" class="%s">%s', $tabs, $listEl, $listId, $listClass, PHP_EOL);
     $output[] = wp_list_comments(['callback' => $callback, 'end-callback' => $endCallback, 'walker' => new CommentWalker(), 'echo' => false]);
     $output[] = sprintf('%s</%s><!-- #%s -->%s', $tabs, $listEl, $listId, PHP_EOL);
     $output = apply_filters('novusopress_comments_list_output', implode('', $output));
     if ($echo) {
         echo $output;
     } else {
         return $output;
     }
 }
 /**
  * Comment list Rendering
  *
  * @package Customizr
  * @since Customizr 3.0
  */
 function tc_comment_list()
 {
     $_args = apply_filters('tc_list_comments_args', array('callback' => array($this, 'tc_comment_callback'), 'style' => 'ul'));
     ob_start();
     ?>
       <ul class="commentlist">
         <?php 
     wp_list_comments($_args);
     ?>
       </ul><!-- .commentlist -->
     <?php 
     $html = ob_get_contents();
     if ($html) {
         ob_end_clean();
     }
     echo apply_filters('tc_comment_list', $html);
 }
 /**
  * @ticket 35175
  */
 public function test_should_respect_reverse_top_level_param()
 {
     $p = self::factory()->post->create();
     $comments = array();
     $now = time();
     for ($i = 0; $i <= 5; $i++) {
         $comments[] = self::factory()->comment->create(array('comment_post_ID' => $p, 'comment_date_gmt' => date('Y-m-d H:i:s', $now - $i), 'comment_author' => 'Commenter ' . $i));
     }
     update_option('page_comments', true);
     update_option('comments_per_page', 2);
     $this->go_to(get_permalink($p));
     // comments_template() populates $wp_query->comments
     get_echo('comments_template');
     $found1 = wp_list_comments(array('reverse_top_level' => true, 'echo' => false));
     preg_match_all('|id="comment\\-([0-9]+)"|', $found1, $matches);
     $this->assertSame(array($comments[0], $comments[1]), array_map('intval', $matches[1]));
     $found2 = wp_list_comments(array('reverse_top_level' => false, 'echo' => false));
     preg_match_all('|id="comment\\-([0-9]+)"|', $found2, $matches);
     $this->assertSame(array($comments[1], $comments[0]), array_map('intval', $matches[1]));
 }
Example #14
0
function supernova_theme_setup()
{
    global $background_defaults, $header_defaults, $wp_version;
    //Featured image for both page and post
    add_theme_support('post-thumbnails');
    //Adds automatic feed links
    add_theme_support('automatic-feed-links');
    //Adds Custom background
    add_theme_support('custom-background', $background_defaults);
    //Adds Custom Header
    add_theme_support('custom-header', $header_defaults);
    add_theme_support("title-tag");
    //Setting Avatar Size
    wp_list_comments('avatar_size=80');
    // Visual Editor Style
    add_editor_style();
    //Loading Language File
    load_theme_textdomain('Supernova', SUPERNOVA_DIR . '/languages');
    //Navigation Registration
    register_nav_menus(array('Header_Nav' => __('Header Navigation', 'Supernova'), 'Header_Cat' => __('Header Categories', 'Supernova'), 'Main_Nav' => __('Main Navigation', 'Supernova'), 'Footer_Nav' => __('Footer Navigation', 'Supernova')));
    do_action('supernova_after_theme_setup');
}
Example #15
0
    /**
     *
     */
    function miss_comment_list()
    {
        //echo apply_filters( 'miss_comments_title', '<h3 id="comments-title">' . sprintf( _n( '1 Comment', '%1$s Comments', get_comments_number(), MISS_TEXTDOMAIN ), number_format_i18n( get_comments_number() ), get_the_title() ) . '</h3>', array( 'comments_number' => get_comments_number(), 'title' =>  get_the_title() ) );
        ?>
<div class="comments">
		<?php 
        wp_list_comments(array('type' => 'all', 'walker' => new zipGun_walker_comment()));
        ?>
	</div>

	<?php 
        if (get_option('page_comments')) {
            ?>
		<div class="comment-navigation paged-navigation">
			<?php 
            paginate_comments_links(miss_portfolio_comment_url($nav = true));
            ?>
		</div><!-- .comment-navigation -->
	<?php 
        }
        ?>

<?php 
    }
Example #16
0
</div>
			</nav><!-- #comment-nav-above -->
			<?php 
    }
    // check for comment navigation
    ?>

			<ol class="comment-list">
				<?php 
    /* Loop through and list the comments. Tell wp_list_comments()
     * to use sz_comment() to format the comments.
     * If you want to override this in a child theme, then you can
     * define sz_comment() and that will be used instead.
     * See sz_comment() in inc/template-tags.php for more.
     */
    wp_list_comments(array('callback' => 'sz_comment', 'avatar_size' => 98));
    ?>
			</ol><!-- .comment-list -->

	</div><!-- #comments -->
</div><!-- .row -->
<hr class="comment-response" />
<div class="row">
	<div class="columns large-10 large-centered">

	<?php 
    if (get_comment_pages_count() > 1 && get_option('page_comments')) {
        // are there comments to navigate through
        ?>
			<nav id="comment-nav-below" class="comment-navigation" role="navigation">
				<h1 class="screen-reader-text"><?php 
    echo '<div id="comments">';
    $count = $wpdb->get_var("\n\t\tSELECT COUNT(meta_value) FROM {$wpdb->commentmeta} \n\t\tLEFT JOIN {$wpdb->comments} ON {$wpdb->commentmeta}.comment_id = {$wpdb->comments}.comment_ID\n\t\tWHERE meta_key = 'rating'\n\t\tAND comment_post_ID = {$post->ID}\n\t\tAND comment_approved = '1'\n\t\tAND meta_value > 0\n\t");
    $rating = $wpdb->get_var("\n\t\tSELECT SUM(meta_value) FROM {$wpdb->commentmeta} \n\t\tLEFT JOIN {$wpdb->comments} ON {$wpdb->commentmeta}.comment_id = {$wpdb->comments}.comment_ID\n\t\tWHERE meta_key = 'rating'\n\t\tAND comment_post_ID = {$post->ID}\n\t\tAND comment_approved = '1'\n\t");
    if ($count > 0) {
        $average = number_format($rating / $count, 2);
        echo '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">';
        echo '<div class="star-rating" title="' . sprintf(__('Rated %s out of 5', 'woocommerce'), $average) . '"><span style="width:' . $average * 10 . 'px"><span itemprop="ratingValue" class="rating">' . $average . '</span> ' . __('out of 5', 'woocommerce') . '</span></div>';
        echo '<h2>' . sprintf(_n('%s review for %s', '%s reviews for %s', $count, 'woocommerce'), '<span itemprop="ratingCount" class="count">' . $count . '</span>', wptexturize($post->post_title)) . '</h2>';
        echo '</div>';
    } else {
        echo '<h2>' . __('Reviews', 'woocommerce') . '</h2>';
    }
    $title_reply = '';
    if (have_comments()) {
        echo '<ol class="commentlist">';
        wp_list_comments(array('callback' => 'woocommerce_comments'));
        echo '</ol>';
        if (get_comment_pages_count() > 1 && get_option('page_comments')) {
            ?>
			<div class="navigation">
				<div class="nav-previous"><?php 
            previous_comments_link(__('<span class="meta-nav">&larr;</span> Previous', 'woocommerce'));
            ?>
</div>
				<div class="nav-next"><?php 
            next_comments_link(__('Next <span class="meta-nav">&rarr;</span>', 'woocommerce'));
            ?>
</div>
			</div>
		<?php 
        }
<?php

// DISPLAY COMMENTS IF COMMENTS ARE OPENED
if (comments_open()) {
    echo '<div class="comments">', '<h2>';
    _e('Comentários', 'wikiwp');
    // alterado
    echo '</h2>';
    if (have_comments()) {
        // this is displayed if there are comments
        echo '<h3>';
        _e('Este post tem', 'wikiwp');
        echo '&nbsp;';
        comments_number(__('0 comentários', 'wikiwp'), __('um comentário', 'wikiwp'), __('% comentários', 'wikiwp'));
        echo '</h3>', '<ul class="commentlist">';
        wp_list_comments();
        echo '</ul>', '<div class="comment-nav">', '<div class="alignleft">';
        previous_comments_link();
        echo '</div>', '<div class="alignright">';
        next_comments_link();
        echo '</div>', '</div>';
    } else {
        // this is displayed if there are no comments so far
        _e('Nenhum comentário!', 'wikiwp');
    }
    // load comment form
    comment_form();
    echo '</div>';
    // end of .content
}
Example #19
0
	<?php 
if (!empty($comments_by_type['pings'])) {
    // let's seperate pings/trackbacks from comments
    $count = count($comments_by_type['pings']);
    $count !== 1 ? $txt = __('Pings&#47;Trackbacks', 'responsive-mobile') : ($txt = __('Pings&#47;Trackbacks', 'responsive-mobile'));
    ?>

		<h2 id="pings"><?php 
    printf(__('%1$d %2$s for "%3$s"', 'responsive-mobile'), $count, $txt, get_the_title());
    ?>
</h2>

		<ol class="commentlist">
			<?php 
    wp_list_comments(array('max_depth' => '<em>', 'type' => 'pings'));
    ?>
		</ol>

	<?php 
}
?>

	<?php 
if (comments_open()) {
    ?>

		<?php 
    $fields = array('author' => '<p class="comment-form-author">' . '<label for="author">' . __('Name', 'responsive-mobile') . '</label> ' . ($req ? '<span class="required">*</span>' : '') . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30" /></p>', 'email' => '<p class="comment-form-email"><label for="email">' . __('E-mail', 'responsive-mobile') . '</label> ' . ($req ? '<span class="required">*</span>' : '') . '<input id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30" /></p>', 'url' => '<p class="comment-form-url"><label for="url">' . __('Website', 'responsive-mobile') . '</label>' . '<input id="url" name="url" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" /></p>');
    comment_form();
    ?>
Example #20
0
&#8221;</h2>

	<ul class="navigation">
		<li class="alignleft"><?php 
    previous_comments_link();
    ?>
</li>
		<li class="alignright"><?php 
    next_comments_link();
    ?>
</li>
	</ul>

	<ol class="commentlist">
<?php 
    wp_list_comments('callback=base_comment');
    ?>
	</ol>

	<ul class="navigation">
		<li class="alignleft"><?php 
    previous_comments_link();
    ?>
</li>
		<li class="alignright"><?php 
    next_comments_link();
    ?>
</li>
	</ul>
	
<?php 
		</p>
	</section>
	<?php 
} elseif (!comments_open() && have_comments()) {
    ?>
	<section id="comments" class="comments">
		<div class="comments-number">
			<h3>
				<?php 
    comments_number(__('Comments', 'founder'), __('One Comment', 'founder'), __('% Comments', 'founder'));
    ?>
			</h3>
		</div>
		<ol class="comment-list">
			<?php 
    wp_list_comments(array('callback' => 'ct_founder_customize_comments', 'max_depth' => '3'));
    ?>
		</ol>
		<?php 
    if (get_option('page_comments') == 1 && get_comment_pages_count() > 1) {
        ?>
			<nav class="comment-pagination">
				<p class="previous-comment"><?php 
        previous_comments_link();
        ?>
</p>
				<p class="next-comment"><?php 
        next_comments_link();
        ?>
</p>
			</nav>
Example #22
0
	  			<div id="comments-nav-below" class="comments-navigation">
						<div class="paginated-comments-links"><?php paginate_comments_links(); ?></div>
	        </div><!-- #comments-nav-below -->
<?php endif; ?>					
					
				</div><!-- #comments-list .comments -->

<?php endif; /* if ( $comment_count ) */ ?>

<?php if ( ! empty($comments_by_type['pings']) ) : ?>

				<div id="trackbacks-list" class="comments">
					<h3><?php printf($ping_count > 1 ? __('<span>%d</span> Trackbacks', 'uthili') : __('<span>One</span> Trackback', 'uthili'), $ping_count) ?></h3>
					
					<ol>
<?php wp_list_comments('type=pings&callback=custom_pings'); ?>
					</ol>				
					
				</div><!-- #trackbacks-list .comments -->			


<?php endif /* if ( $ping_count ) */ ?>
<?php endif /* if ( $comments ) */ ?>

<?php if ( 'open' == $post->comment_status ) : ?>
				<div id="respond">
    				<h3><?php comment_form_title( __('Post a Comment', 'uthili'), __('Post a Reply to %s', 'uthili') ); ?></h3>
    				
    				<div id="cancel-comment-reply"><?php cancel_comment_reply_link() ?></div>

<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
Example #23
0
</div>
				<div class="nav-next"><?php 
        next_comments_link(esc_html__('Newer Comments', 'bftp'));
        ?>
</div>

			</div><!-- .nav-links -->
		</nav><!-- #comment-nav-above -->
		<?php 
    }
    // Check for comment navigation.
    ?>

		<ol class="comment-list">
			<?php 
    wp_list_comments(array('style' => 'ol', 'short_ping' => true));
    ?>
		</ol><!-- .comment-list -->

		<?php 
    if (get_comment_pages_count() > 1 && get_option('page_comments')) {
        // Are there comments to navigate through?
        ?>
		<nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
			<h2 class="screen-reader-text"><?php 
        esc_html_e('Comment navigation', 'bftp');
        ?>
</h2>
			<div class="nav-links">

				<div class="nav-previous"><?php 
Example #24
0
	<?php 
    }
    ?>
		    
	<?php 
    if (!empty($comments_by_type['pings'])) {
        ?>
    		
        <h3 id="pings"><?php 
        _e('Trackbacks/Pingbacks', 'woothemes');
        ?>
</h3>
    
        <ol class="pinglist">
            <?php 
        wp_list_comments('type=pings&callback=list_pings');
        ?>
        </ol>
    	
	<?php 
    }
    ?>
    	
</div> <!-- /#comments_wrap -->

<?php 
} else {
    // this is displayed if there are no comments so far
    ?>

Example #25
0
							<div class="reply">
							<?php 
        comment_reply_link(array_merge($args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'])));
        ?>
							<span class="grey">
								<?php 
        edit_comment_link(__('Edit', 'maskitto-light'), '  ', '');
        ?>
							</span>
							</div>
						</div>
					</div>

				<?php 
    }
    wp_list_comments(array('style' => 'ol', 'short_ping' => true, 'avatar_size' => 54, 'max_depth' => '5', 'callback' => 'maskitto_light_comment'));
    ?>
			</ol><!-- .comment-list -->


			<?php 
    if (get_comment_pages_count() > 1 && get_option('page_comments')) {
        // are there comments to navigate through
        ?>
				<div class="comment-navigation grey-light"><?php 
        paginate_comments_links();
        ?>
</div>
			<?php 
    }
    // check for comment navigation
Example #26
0
</div>
		</nav>
		<?php 
    }
    // check for comment navigation
    ?>

		<ol class="commentlist">
			<?php 
    /* Loop through and list the comments. Tell wp_list_comments()
     * to use _abelard_comment() to format the comments.
     * If you want to overload this in a child theme then you can
     * define _abelard_comment() and that will be used instead.
     * See _abelard_comment() in functions.php for more.
     */
    wp_list_comments(array('callback' => '_abelard_comment'));
    ?>
		</ol>

		<?php 
    if (get_comment_pages_count() > 1 && get_option('page_comments')) {
        // are there comments to navigate through
        ?>
		<nav role="navigation" id="comment-nav-below" class="site-navigation comment-navigation">
			<h1 class="assistive-text"><?php 
        _e('Comment navigation', 'abelard');
        ?>
</h1>
			<div class="nav-previous"><?php 
        previous_comments_link(__('&larr; Older Comments', 'abelard'));
        ?>
Example #27
0
if ( post_password_required() || ( !have_comments() && !comments_open() && !pings_open() ) )
	return;
?>

<div id="comments-template">

	<?php if ( have_comments() ) : ?>

		<div id="comments">
			
			<h3 id="comments-number" class="comments-header"><?php comments_number( sprintf( __( 'No responses to %1$s', hybrid_get_parent_textdomain() ), the_title( '&#8220;', '&#8221;', false ) ), sprintf( __( 'One response to %1$s', hybrid_get_parent_textdomain() ), the_title( '&#8220;', '&#8221;', false ) ), sprintf( __( '%1$s responses to %2$s', hybrid_get_parent_textdomain() ), '%', the_title( '&#8220;', '&#8221;', false ) ) ); ?></h3>

			<?php do_atomic( 'before_comment_list' ); // Before comment list hook ?>
			
			<ul class="comment-list">
				<?php wp_list_comments( hybrid_list_comments_args() ); ?>
			</ul><!-- .comment-list -->

			<?php do_atomic( 'after_comment_list' ); // After comment list hook ?>

			<?php if ( get_option( 'page_comments' ) ) : ?>
				<div class="comment-navigation comment-pagination paged-navigation">
					<?php paginate_comments_links(); ?>
				</div><!-- .comment-navigation -->
			<?php endif; ?>

		</div><!-- #comments -->

	<?php else : ?>

		<?php if ( pings_open() && !comments_open() ) : ?>
 public static function wp_list_comments($args = array())
 {
     $echo = !isset($args['echo']) || $args['echo'];
     $args['style'] = 'div';
     $args['callback'] = array(__CLASS__, '_render_comment');
     $args['end-callback'] = array(__CLASS__, '_end_comment');
     $args['echo'] = false;
     if (!isset($args['avatar_size'])) {
         $args['avatar_size'] = 120;
     }
     $output = \wp_list_comments($args);
     if (!$output) {
         return '';
     }
     $output = '<ul class="comment-list media-list">' . $output . '</ul>';
     if (isset($args['before'])) {
         $output = $args['before'] . $output;
     }
     if (isset($args['after'])) {
         $output .= $args['after'];
     }
     if ($echo) {
         echo $output;
     } else {
         return $output;
     }
 }
    public function sfw_comment_form_header()
    {
        global $comment;
        // Comment form header start
        if (post_password_required()) {
            ?>
			<p class="sfw-no-password">This post is password protected. Enter the password to view comments.</p>
			<?php 
            return;
        }
        // if comments are open
        if (have_comments()) {
            ?>
			<h2 id="sfw-comments-title">
			<?php 
            printf(_n('One comment on &ldquo;%2$s&rdquo;', '%1$s comments on &ldquo;%2$s&rdquo;', get_comments_number()), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>');
            ?>
			</h2>
			<?php 
            // Generates the list of comments
            ?>
			<ol class="sfw-commentlist">
			<?php 
            wp_list_comments(array('callback' => array($this, 'SFWlist_comments')));
            ?>
			</ol>
			<?php 
            // if comments are paginated (broken into pages) provides link to next and previous page
            if (get_comment_pages_count() > 1 && get_option('page_comments')) {
                // are there comments to navigate through
                ?>
				<div id="sfw-comment-nav-above">
					<div class="sfw-nav-previous">
					<?php 
                previous_comments_link('&larr; Older Comments');
                ?>
					</div>
					<div class="sfw-nav-next">
					<?php 
                next_comments_link('Newer Comments &rarr;');
                ?>
					</div>
				</div>
				<?php 
            }
        } elseif (!comments_open() && !is_page() && post_type_supports(get_post_type(), 'comments')) {
            ?>
			<p class="sfw-nocomments">Comments are closed.</p>
			<?php 
        }
        // Comment form header end
        // Call the comment form template
        $this->sfw_comment_form();
    }
Example #30
-31
function get_all_comments_list()
{
    global $post;
    ob_start();
    //exit(has_shortcode($post->post_content, 'list_comments'));
    # The comment functions use the query var 'cpage', so we'll ensure that's set
    $page = intval(get_query_var('cpage'));
    if (0 == $page) {
        $page = 1;
        set_query_var('cpage', $page);
    }
    # We'll do 10 comments per page...
    # Note that the 'page_comments' option in /wp-admin/options-discussion.php must be checked
    $comments_per_page = 10;
    $comments = get_comments(array('status' => 'approve', 'meta_key' => 'notify_user', 'meta_value' => get_current_user_id()));
    ?>
    <ol start="<?php 
    echo $comments_per_page * $page - $comments_per_page + 1;
    ?>
">
        <?php 
    wp_list_comments(array('style' => 'ol', 'per_page' => $comments_per_page, 'page' => $page, 'reverse_top_level' => false), $comments);
    ?>
    </ol>

    <?php 
    // Now you can either use paginate_comments_links ...
    paginate_comments_links();
    $html = ob_get_contents();
    ob_end_clean();
    return $html;
}