public function widget($args, $instance) { $title = apply_filters('widget_title', @$instance['title']); echo $args['before_widget']; if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } $ans_count = ap_question_get_the_answer_count(); $last_active = ap_question_get_the_active_ago(); $total_subs = ap_question_get_the_subscriber_count(); $view_count = ap_question_get_the_view_count(); echo '<div class="ap-widget-inner">'; if (is_question()) { echo '<ul class="ap-stats-widget">'; echo '<li><span class="stat-label apicon-pulse">' . __('Active', 'ap') . '</span><span class="stat-value"><time class="published updated" itemprop="dateModified" datetime="' . mysql2date('c', $last_active) . '">' . ap_human_time(mysql2date('U', $last_active)) . '</time></span></li>'; echo '<li><span class="stat-label apicon-eye">' . __('Views', 'ap') . '</span><span class="stat-value">' . sprintf(_n('One time', '%d times', $view_count, 'ap'), $view_count) . '</span></li>'; echo '<li><span class="stat-label apicon-answer">' . __('Answers', 'ap') . '</span><span class="stat-value">' . sprintf(_n('%2$s1%3$s answer', '%2$s%1$d%3$s answers', $ans_count, 'ap'), $ans_count, '<span data-view="answer_count">', '</span>') . '</span></li>'; echo '<li><span class="stat-label apicon-mail">' . __('Followers', 'ap') . '</span><span class="stat-value">' . sprintf(_n('1 follower', '%d followers', $total_subs, 'ap'), $total_subs) . '</span></li>'; echo '</ul>'; } else { _e('This widget can only be used in single question page', 'ap'); } echo '</div>'; echo $args['after_widget']; }
<div class="ap-questions-widget clearfix"> <?php if (ap_have_questions()) { /* Start the Loop */ while (ap_questions()) { ap_the_question(); $ans_count = ap_question_get_the_answer_count(); $net_vote = ap_question_get_the_net_vote(); ?> <div class="ap-question-item"> <a class="ap-question-title"href="<?php ap_question_the_permalink(); ?> "><?php the_title(); ?> </a> <span class="ap-ans-count"><?php printf(_n('1 answer', '%d answers', $ans_count, 'ap'), $ans_count); ?> </span> <span class="ap-vote-count"> | <?php printf(_n('1 vote', '%d votes', $net_vote, 'ap'), $net_vote); ?> </span> </div> <?php } } else { _e('No questions found.', 'ap'); }
ap_the_question(); ?> <div class="ap-user-posts-item clearfix"> <a class="ap-user-posts-vcount ap-tip<?php echo ap_question_best_answer_selected() ? ' answer-selected' : ''; ?> " href="<?php ap_question_the_permalink(); ?> " title="<?php _e('Answers'); ?> "><?php echo ap_icon('answer', true); echo ap_question_get_the_answer_count(); ?> </a> <span class="ap-user-posts-active"><?php ap_question_the_active_ago(); ?> </span> <a class="ap-user-posts-ccount ap-tip" href="<?php ap_question_the_permalink(); ?> " title="<?php _e('Comments', 'ap'); ?> "><?php echo ap_icon('comment', true); echo get_comments_number();
function ap_question_the_answer_count() { echo '<a class="ap-questions-count ap-questions-acount" href="' . ap_answers_link() . '"><span>' . ap_question_get_the_answer_count() . '</span>' . __('ans', 'ap') . '</a>'; }
function ap_question_the_answer_count() { $count = ap_question_get_the_answer_count(); echo '<a class="ap-questions-count ap-questions-acount" href="' . ap_answers_link() . '">' . sprintf(_n('%s ans', '%s ans', $count, 'ap'), '<span>' . $count . '</span>') . '</a>'; }
?> " title="<?php _e('Votes', 'ap'); ?> "><?php echo ap_icon('thumb-up', true); echo ap_question_get_the_answer_count(); ?> </a> <span class="ap-user-posts-active"><?php ap_question_the_active_ago(); ?> </span> <a class="ap-user-posts-ccount ap-tip" href="<?php ap_question_the_permalink(); ?> " title="<?php _e('Answers', 'ap'); ?> "><?php printf(__('%d answers', 'ap'), ap_question_get_the_answer_count()); ?> </a> <div class="no-overflow"><a href="<?php ap_question_the_permalink(); ?> " class="ap-user-posts-title"><?php the_title(); ?> </a></div> </div>
<?php echo ap_question_get_the_net_vote(); ?> </a> <span class="ap-user-posts-active"> <?php ap_question_the_active_ago(); ?> </span> <a class="ap-user-posts-ccount ap-tip" href="<?php ap_question_the_permalink(); ?> " title="<?php esc_attr_e('Answers', 'anspress-question-answer'); ?> "> <?php printf(__('%d answers', 'anspress-question-answer'), ap_question_get_the_answer_count()); ?> </a> <div class="no-overflow"> <a href="<?php ap_question_the_permalink(); ?> " class="ap-user-posts-title"><?php the_title(); ?> </a> </div> </div>