echo esc_attr(sprintf(__('Permalink to %s', 'dwqa'), the_title_attribute('echo=0'))); ?> " rel="bookmark"><?php the_title(); ?> </a> <div class="dwqa-meta"> <?php do_action('dwqa_question_meta'); ?> </div> </header> <footer class="dwqa-footer-meta"> <div class="dwqa-comment"> <?php $answer_count = dwqa_question_answers_count(); ?> <?php if ($answer_count > 0) { printf('<strong>%d</strong> %s', $answer_count, _n('answer', 'answers', $answer_count, 'dwqa')); ?> <?php } else { echo '<strong>0</strong> ' . __('answer', 'dwqa'); } ?> </div> </footer> </article>
function dwqa_question_columns_content($column_name, $post_ID) { switch ($column_name) { case 'info': echo ucfirst(get_post_meta($post_ID, '_dwqa_status', true)) . '<br>'; echo '<strong>' . dwqa_question_answers_count($post_ID) . '</strong> ' . __('answered', 'dwqa') . '<br>'; echo '<strong>' . dwqa_vote_count($post_ID) . '</strong> ' . __('voted', 'dwqa') . '<br>'; echo '<strong>' . dwqa_question_views_count($post_ID) . '</strong> ' . __('views', 'dwqa') . '<br>'; break; case 'question-category': $terms = wp_get_post_terms($post_ID, 'dwqa-question_category'); $i = 0; foreach ($terms as $term) { if ($i > 0) { echo ', '; } echo '<a href="' . get_term_link($term, 'dwqa-question_category') . '">' . $term->name . '</a> '; $i++; } break; case 'question-tag': $terms = wp_get_post_terms($post_ID, 'dwqa-question_tag'); $i = 0; foreach ($terms as $term) { if ($i > 0) { echo ', '; } echo '<a href="' . get_term_link($term, 'dwqa-question_tag') . '">' . $term->name . '</a> '; $i++; } break; } }
/** * The template for displaying answers * * @package DW Question & Answer * @since DW Question & Answer 1.4.0 */ ?> <div class="dwqa-answers"> <?php do_action('dwqa_before_answers'); ?> <?php if (dwqa_has_answers()) { ?> <div class="dwqa-answers-title"><?php printf(__('%s Answers', 'dwqa'), dwqa_question_answers_count(get_the_ID())); ?> </div> <div class="dwqa-answers-list"> <?php do_action('dwqa_before_answers_list'); ?> <?php while (dwqa_has_answers()) { dwqa_the_answers(); ?> <?php $question_id = get_post_meta(get_the_ID(), '_question', true); ?> <?php if ('private' == get_post_status() && (dwqa_current_user_can('edit_answer', get_the_ID()) || dwqa_current_user_can('edit_question', $question_id)) || 'publish' == get_post_status()) {