Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $pid = $post->ID;
- $comment_query = "SELECT * FROM `wp_comments` WHERE comment_post_ID = ".$pid. " AND comment_approved = '1'";
- $comments_array = $wpdb->get_results($comment_query, OBJECT);
- if ($comments_array):
- $cpp = 10; // Comments per page
- $wp_query->comments = count($comments_array);
- //echo $wp_query->found_posts;
- $wp_query->max_num_pages = ceil($wp_query->comments / $cpp);
- $on_page = intval(get_query_var('paged'));
- if($on_page == 0){ $on_page = 1; }
- $offset = ($on_page-1) * $cpp;
- $wp_query->request = "
- SELECT * FROM `wp_comments` WHERE comment_post_ID = ".$pid. " AND comment_approved = '1'
- LIMIT $cpp
- OFFSET $offset
- ";
- $newcomments = $wpdb->get_results($wp_query->request, OBJECT);
- ?>
- <div class="comments">
- <?php if ($newcomments) : ?>
- <a name="comments" id="comment_anchor"></a>
- <h3 class="section-title"><?php _(comments_number('No <span>Comments</span>','1 <span>Comment</span>','% <span>Comments</span>')); ?></h3>
- <ul class="comment-container">
- <?php
- foreach ($newcomments as $comment) :
- if ($comment->comment_parent == 0) :
- $comment_table = $wpdb->prefix . "ocmx_comment_meta";
- $comment_meta_sql = "SELECT * FROM $comment_table WHERE commentId = ".$comment->comment_ID." LIMIT 1";
- $comment_meta = $wpdb->get_row($comment_meta_sql);
- $comment_type = get_comment_type();
- $date = $comment->comment_date_gmt;
- $ctime = time_difference($date);
- $comment_user_id_get = $wpdb->prepare( "select ID from $wpdb->comments b INNER JOIN $wpdb->users a where a.user_login='$comment->comment_author'" );
- $comment_user_id = $wpdb->get_row( $comment_user_id_get );
- $loverid = $comment_user_id->ID;
- $social_img = get_cimyFieldValue($loverid, 'PROFILE_SOC_IMG');
- $social_img_result = cimy_uef_sanitize_content($social_img);
- $twitty_value = get_user_meta($loverid,'twitty',true);
- $fb_value = get_user_meta($loverid, 'facebook', true);
- ?>
- .........
- <?php endif; ?>
- <?php endforeach; ?>
- <? endif; ?>
- <li id="new_comments"></li>
- </ul>
- <?php else : ?>
- <a name="comments" id="comment_anchor"></a>
- <div id="new_comments"></div>
- <?php endif; ?>
- </div>
- <div class="pag_pos">
- <?php wp_pagenavi(); ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement