function widget($args, $instance) { // prints the widget extract($args, EXTR_SKIP); $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); $number = empty($instance['number']) ? '5' : apply_filters('widget_number', $instance['number']); ?> <div class="widget popular"> <?php if ($title) { ?> <h3><?php echo $title; ?> </h3><?php } ?> <ul> <?php global $wpdb; $now = gmdate("Y-m-d H:i:s", time()); $lastmonth = gmdate("Y-m-d H:i:s", gmmktime(date("H"), date("i"), date("s"), date("m") - 12, date("d"), date("Y"))); $popularposts = "SELECT ID, post_title,post_date, COUNT({$wpdb->comments}.comment_post_ID) AS 'stammy' FROM {$wpdb->posts}, {$wpdb->comments} WHERE comment_approved = '1' AND {$wpdb->posts}.ID={$wpdb->comments}.comment_post_ID AND post_status = 'publish' AND post_date < '{$now}' AND post_date > '{$lastmonth}' AND comment_status = 'open' GROUP BY {$wpdb->comments}.comment_post_ID ORDER BY stammy DESC LIMIT {$number}"; $posts = $wpdb->get_results($popularposts); $popular = ''; if ($posts) { foreach ($posts as $post) { $post_title = stripslashes($post->post_title); $guid = get_permalink($post->ID); $first_post_title = substr($post_title, 0, 26); ?> <li> <a href="<?php echo $guid; ?> " title="<?php echo $post_title; ?> "><?php echo $first_post_title; ?> </a> <br /> <span class="date"><?php echo get_the_time(templ_get_date_format(), $post); ?> at <?php echo get_the_time(templ_get_time_format(), $post); ?> </span> </li> <?php } } ?> </ul> </div> <?php }
function templ_date_formated($date) { $date_format = templ_get_date_format(); if ($date) { return apply_filters('templ_get_formated_date_filter', date($date_format, strtotime($date))); } }
echo DISABLE_END_TIME; ?> </label></span> <div class="form_row clearfix" id="end_deal_time"> <label><?php echo DEAL_START_END_TIME; ?> </label> <input type="text" name="coupon_end_date" id="coupon_end_date" class="textfield calendar_text" value="<?php echo $coupon_end_date; ?> "/> <img style="margin:0px" src="<?php echo bloginfo('template_directory'); ?> /images/cal.gif" alt="Calendar" onclick="displayCalendar(document.postdeal_frm.coupon_end_date,'<?php echo templ_get_date_format(); ?> ',this)" class="calendar_img"> <label class="time_label"><?php echo DEAL_HH; ?> </label> <select name="coupon_end_time_hh" class="textfield time_select"> <?php for ($i = 0; $i <= 23; $i++) { if ($i < 10) { $i = "0" . $i; } ?> <option value="<?php echo $i;
<?php $ptitle = sprintf(__('%s', 'templatic'), single_cat_title('', false)); ?> <?php /* If this is a tag archive */ } elseif (is_tag()) { ?> <?php $ptitle = sprintf(__('Posts tagged "%s"', 'templatic'), single_tag_title('', false)); ?> <?php /* If this is a daily archive */ } elseif (is_day()) { ?> <?php $ptitle = sprintf(__('Daily archive %s', 'templatic'), get_the_time(templ_get_date_format())); ?> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> <?php $ptitle = sprintf(__('Monthly archive %s', 'templatic'), get_the_time('F, Y')); ?> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <?php $ptitle = sprintf(__('Yearly archive %s', 'templatic'), get_the_time('Y')); ?>