function comment_count($type, $id) { $sql = "SELECT id FROM " . PREFIX . "comment WHERE comment_type='" . $type . "' AND comment_on='" . $id . "';"; $return = 0; if ($cc = mysql_query($sql)) { while ($c = mysql_fetch_assoc($cc)) { $return++; $return += comment_count('comment', $c['id']); } } return $return; }
<td>ㆍ</td> <td><a href="<?php echo MAIN_URL; ?> /<?php echo $row['bc_code']; ?> /view/<?php echo $row['b_idx']; ?> "><?php echo reply_str($row['b_reply']); echo $row['b_title']; ?> <?php echo comment_count($row['c_cnt']); ?> </a></td> <td class="nickname" id="article_<?php echo $row['m_id']; ?> "><?php echo $row['m_name']; ?> </td> <td><?php echo today_check($row['b_regdate']); ?> </td> <td><?php echo $row['b_cnt'];
<textarea class="form-control from-comment mention" placeholder="Add a comment....." onfocus="this.placeholder = ''" onblur="this.placeholder = 'Add a comment.....'" id="commentsubmit_<?php echo $val['id']; ?> " ></textarea> <a href="javascript:;" class="enter-text"><i class="fa fa-level-down"></i></a> </div> <div class="load-more common-new"> <a href="javascript:;" rel="#comment-target" class="common-story-section foo_<?php echo $val['id']; ?> " id="<?php echo $val['id'] . '_' . $val['url_slug']; ?> "> <?php if (comment_count($val['id']) > 0) { ?> <i class="fa fa-arrow-up"></i> View all <span class="story_comment_<?php echo $val['id']; ?> "><?php echo comment_count_html($val['id']); ?> </span> <?php } ?> </a> </div> </div>
function feedback_count_comments() { //Man får ju börja med att sätta allt till noll... mysql_query("UPDATE " . PREFIX . "feedback SET comments=0;"); $sql = "SELECT id FROM " . PREFIX . "feedback WHERE resolved IS NULL checked_in IS NULL AND not_implemented IS NULL;"; // echo "<br />DEBUG2309: $sql"; if ($cc = mysql_query($sql)) { while ($c = mysql_fetch_array($cc)) { $nr_comments = comment_count("feedback", $c['id']); feedback_add_comments_and_parents($c['id'], $nr_comments); } } }
function blox_loop_grid_hook($options) { $options = array_merge(array('overlay' => 'none', 'excerpt' => 'nocontent', 'readmore' => '', 'grid' => '4', 'element_style' => 'default'), $options); global $post, $layout_sidebar; $crop_width = 173; if ($layout_sidebar == 'full') { $crop_width = 247; } $class = 'col-md-3 col-sm-6 col-xs-12'; if ($options['grid'] == '2') { $class = 'col-md-6 col-sm-6 col-xs-12'; } else { if ($options['grid'] == '3') { $class = 'col-md-4 col-sm-6 col-xs-12'; } } $post_format = get_post_format(); $post_format = $post_format != '' ? $post_format : 'standard'; ?> <div class="<?php echo $class; ?> loop-item"> <article itemscope itemtype='http://schema.org/BlogPosting' <?php post_class('entry ' . $options['element_style'] . ' format-' . $post_format); ?> > <?php echo hover_featured_image(array('overlay' => $options['overlay'])); ?> <div class="relative"> <div class="entry-title"> <h2 itemprop="headline"> <a itemprop="url" href="<?php echo permalink(); ?> "><?php the_title(); ?> </a> </h2> </div> <?php blox_post_content(array('excerpt' => $options['excerpt'], 'button' => 'small', 'readmore' => $options['readmore'])); ?> <ul class="entry-meta list-inline"> <li itemprop="datePublished" class="meta-date"><?php echo date_i18n(get_option('date_format'), strtotime(get_the_date())); ?> </li> <li itemprop="author" class="meta-author"><?php echo __("By ", "themeton") . get_author_posts_link(); ?> </li> <li itemprop="keywords" class="meta-category"><?php echo __('In', 'themeton') . ' ' . get_the_category_list(', '); ?> </li> <li itemprop="comment" class="meta-comment pull-right"><?php echo comment_count(); ?> </li> <li class="meta-like pull-right"><?php echo get_post_like(get_the_ID()); ?> </li> </ul> </div> </article> </div> <?php }
/** * convert userdata to an object * @param object $user * @return user object after convert * - wp_error object if user invalid * @author Dakachi * @since 1.0 */ public function convert($user) { global $current_user, $user_ID; if (!isset($user->ID) || !$user->ID) { return new WP_Error('ae_invalid_user_data', __("Input invalid", ET_DOMAIN)); } $result = isset($user->data) ? $user->data : $user; foreach ($this->meta_data as $key) { $result->{$key} = get_user_meta($result->ID, $key, true); } $result->avatar = get_avatar($user->ID, '150'); $result->join_date = sprintf(__("Join on %s", ET_DOMAIN), (string) date(get_option('date_format'), strtotime($user->user_registered))); /** * get user role */ if (current_user_can('edit_users') && isset($user->roles)) { $user_role = $user->roles; $result->role = array_pop($user_role); $result->roles = $user->roles; } /** * get all user meta data */ $author_metas = array('display_name', 'first_name', 'last_name', 'description', 'user_url'); foreach ($author_metas as $key => $author_meta) { $result->{$author_meta} = get_the_author_meta($author_meta, $result->ID); } $result->label = sprintf(__('Logged in as <span class="name">%s<span>', ET_DOMAIN), $result->display_name); $result->author_url = get_author_posts_url($result->ID); // update ajax nonce if ($current_user->ID == $result->ID) { // temporary use de create nonce to find solution $result->ajaxnonce = de_create_nonce('ad_carousels_et_uploader'); $result->logoajaxnonce = de_create_nonce('user_avatar_et_uploader'); } /** * return post count */ $result->post_count = count_user_posts($result->ID); /** * return comment count */ if (isset($result->user_email) && $result->user_email !== '') { $result->comment_count = comment_count($result->user_email); } else { $result->comment_count = 0; } if (!current_user_can('edit_users') && $user_ID != $result->ID) { $unset = array('user_email', 'role'); unset($result->role); unset($result->user_email); } // unset($result->user_email); $result->id = $result->ID; // Convert banned if ($this->is_ban($result)) { $result->banned = true; } else { $result->banned = false; } // Convert ban info $ban_info = $this->get_ban_info($result->id); $result->ban_expired = $ban_info['expired']; $result->ban_note = $ban_info['note']; unset($result->user_pass); unset($result->user_activation_key); $this->current_user = apply_filters('ae_convert_user', $result); return $this->current_user; }
<span id="comment_msg_<?php echo $val['id']; ?> "></span> <textarea class="form-control" placeholder="Add a comment....." id="commentsubmit_<?php echo $val['id']; ?> " ></textarea> <a href="javascript:;" class="enter-text"><i class="fa fa-level-down"></i></a> </div> <div class="load-more common-new"> <a href="javascript:;" rel="#comment-target" class="common-story-section" id="<?php echo $val['id']; ?> "><i class="fa fa-arrow-up"></i> View all <?php echo comment_count($val['id']) > 0 ? comment_count($val['id']) . ' Comments' : ' Comments'; ?> </a> </div> </div> <?php } } else { //echo 'No Record Found '; } ?>
function shortcode_jw_recent_posts($atts, $content) { global $portAtts; $portAtts = $atts; $atts['excerpt_count'] = isset($atts['excerpt_count']) ? intval($atts['excerpt_count']) : 50; $more_text = !empty($atts['more_text']) ? $atts['more_text'] : (jw_option('translate_readmore') ? jw_option('translate_readmore') : __('Read More', 'designinvento')); $more_text_show = isset($atts['more_text_show']) ? $atts['more_text_show'] : 'false'; $hide_meta = isset($atts['hide_meta']) ? $atts['hide_meta'] : 'false'; $post_count = isset($atts['post_count']) ? $atts['post_count'] : ''; $post_category_list = isset($atts['post_category_list']) ? $atts['post_category_list'] : ''; $arrow = '<div class="carousel-arrow jw-carrow">'; $arrow .= '<a class="carousel-prev" href="#"><i class="icon-angle-left"></i></a>'; $arrow .= '<a class="carousel-next" href="#"><i class="icon-angle-right"></i></a>'; $arrow .= '</div>'; $output = '<div class="carousel-container">'; $output .= '<div class="jw-carousel-post list_carousel">'; $output .= '<ul class="jw-carousel">'; $query = array('post_type' => 'post', 'posts_per_page' => $post_count); $cats = explode(",", $post_category_list); if (!empty($cats[0])) { $query['tax_query'] = array(array('taxonomy' => 'category', 'terms' => $cats, 'field' => 'id')); } if (!empty($atts['order'])) { switch ($atts['order']) { case "date_asc": $query['orderby'] = 'date'; $query['order'] = 'ASC'; break; case "title_asc": $query['orderby'] = 'title'; $query['order'] = 'ASC'; break; case "title_desc": $query['orderby'] = 'title'; $query['order'] = 'DESC'; break; case "random": $query['orderby'] = 'rand'; break; } } $imgwidth = 370; // START - LOOP query_posts($query); while (have_posts()) { the_post(); $imgheight = $atts['image_height']; $output .= '<li>'; if (get_post_format() == "video") { $output .= '<div class="carousel-video" style="height:' . $imgheight . 'px;">'; ob_start(); format_video(); $output .= ob_get_clean(); $output .= '</div>'; } else { if (post_image_show()) { ob_start(); portfolio_image($imgwidth, $imgheight); $output .= ob_get_clean(); } } $output .= '<div class="carousel-content">'; if ($hide_meta === 'false') { $output .= '<div class="carousel-meta clearfix"><div class="date"><i class="icon-calendar-empty"></i>' . get_the_time('j M Y') . '</div><div class="comment-count"><i class="icon-comments-alt"></i>' . comment_count() . '</div></div>'; } $output .= '<h3><a href="' . get_permalink() . '" class="carousel-post-title">' . get_the_title() . '</a></h3>'; $output .= '<p>' . to_excerpt(get_the_content(), $atts['excerpt_count']) . '</p>'; if ($more_text_show === 'true') { $output .= '<div class="read-more-container"><a href="' . get_permalink() . '" class="more-link">' . apply_filters("widget_title", $more_text) . '</a></div>'; } $output .= '</div>'; $output .= '</li>'; } wp_reset_query(); // END - LOOP $output .= '</ul>'; $output .= '<div class="clearfix"></div>'; $output .= $arrow; $output .= '</div>'; $output .= '</div>'; return $output; }
<span id="comment_msg_<?php echo $users_story_val['id']; ?> "></span> <textarea style="color:#000" placeholder="Add a comment....." class="form-control from-comment" id="commentsubmit_<?php echo $users_story_val['id']; ?> "></textarea> <a class="enter-text" href="javascript:;"><i class="fa fa-level-down"></i></a> </div> <div class="load-more common-new"> <a class="common-story-section" rel="#comment-target" href="javascript:;" id="<?php echo $users_story_val['id']; ?> "><i class="fa fa-arrow-up"></i> View all <?php echo comment_count($users_story_val['id']) > 0 ? comment_count($users_story_val['id']) . ' Comments' : ' Comments'; ?> </a> </div> </div> </div> <?php } } ?> </div> </div>