/** * Display the language string for the number of comments the current post has. * * @since 0.71 * @uses apply_filters() Calls the 'comments_number' hook on the output and number of comments respectively. * * @param string $zero Text for no comments * @param string $one Text for one comment * @param string $more Text for more than one comment * @param string $deprecated Not used. */ function comments_number($zero = false, $one = false, $more = false, $deprecated = '') { if (!empty($deprecated)) { _deprecated_argument(__FUNCTION__, '1.3'); } #$number = get_comments_number(); if (!$post_id) { $post_id = get_the_ID(); } $number = lhg_get_comments_number($post_id); if ($number > 1) { $output = str_replace('%', number_format_i18n($number), false === $more ? __('% Comments') : $more); } elseif ($number == 0) { $output = false === $zero ? __('No Comments') : $zero; } else { // must be one $output = false === $one ? __('1 Comment') : $one; } echo apply_filters('comments_number', $output, $number); }
public function widget($args, $lhg_instance) { //show only for english pages (missing translation of articles) // ToDo: Check if translation exists, otherwise hide global $region; if ($region == "fr" or $region == "es" or $region == "it" or $region == "nl" or $region == "co.jp" or $region == "cn") { return; } #echo "INS: ".$instance['title']; #var_dump($lhg_instance); $title = apply_filters('widget_title', $lhg_instance['title']); $artid = $lhg_instance['artid']; $default_image = ""; $text = get_post_field('post_content', $artid); $text = lhg_clean_extract($text, 600); $more = "(more)"; $posttitle = translate_title(get_the_title($artid)); $s = explode("(", $posttitle); $short_title = trim($s[0]); $sub_title = trim($s[1]); $sub_title = str_replace(")", "", $sub_title); //get the latest date global $wpdb; $sql = "\n SELECT post_modified\n FROM {$wpdb->posts}\n WHERE ID = " . $artid; $last_update = $wpdb->get_var($sql); $wpdf = get_option('date_format'); $lupdate = date($wpdf, strtotime($last_update)); // get comments $cn = lhg_get_comments_number($artid); if ($cn > 0) { //Comment tooltip $txt_comments = $txt_cpl_comments; //"Kommentare"; //if ($lang == "en") $txt_comments="comments"; if ($cn == 1) { $txt_comments = $txt_cpl_comment; //"Kommentar"; //if ($lang == "en") $txt_comments="comment"; } $coutInv = ''; //<span class="comment-count-out-invisible"></span>'; $cout = '<a href="' . $arturl . '#comments" alt="' . $cn . ' ' . $txt_comments . '" title="' . $cn . ' ' . $txt_comments . '"> <div class="comment-count-out"> <span class="comment-bubble"></span> <span class="comment-count">' . $cn . '</span> </div> </a>'; } else { $coutInv = ""; $cout = ""; } //ratings $ratings = the_ratings_results($artid, 0, 0, 0, 10); #var_dump($last_update); #var_dump($wpdf); #$sql = "SELECT post_modified # FROM $wpdb->posts # WHERE post_id ='".$artid."'"; #$last_update = $wdpb->get_var( $sql ); #echo( "Last updated $lupdate ." ); #$date = get_the_modified_date($artid) $permalink = get_permalink($artid); $image = get_the_post_thumbnail($artid, array(130, 130)); #echo "ARGS: $args"; #var_dump($args); extract($args); #var_dump($instance); #echo "TIT: ".$instance['title']; echo "{$before_widget}"; #$title = apply_filters ( 'widget_title', $instance['title'] ); #$artid = empty( $instance['artid'] ) ? ' ' : $instance['artid']; #if ( !empty( $title ) ) { echo $before_title . $title . $after_title; #}; echo '<div class="featured-hw">'; #echo '<div class="featured-title-date">'.$lupdate.':</div>'; echo '<div class="featured-title"><a href="' . $permalink . '">' . $short_title . '</a></div> <span class="featured-comments">' . $cout . '</span> <span class="featured-ratings">' . $ratings . '</span> <div class="featured-title-sub"><a href="' . $permalink . '">(' . $sub_title . ')</a></div> <div class="featured-image"><a href="' . $permalink . '">' . $image . '</a></div> ' . $text . '... <a href="' . $permalink . '">' . $more . '</a></p>'; echo "</div>"; echo $after_widget; }