public function ap_save_labels() { if (ap_user_can_change_label() && wp_verify_nonce($_POST['nonce'], 'label-' . $_POST['id'])) { if (isset($_POST['args'])) { $ids = array(); foreach ($_POST['args'] as $id) { $ids[] = (int) $id; } $post_id = (int) sanitize_text_field($_POST['id']); $existing = get_the_terms($post_id, 'question_label'); wp_set_post_terms($post_id, $ids, 'question_label'); update_post_meta($post_id, ANSPRESS_UPDATED_META, current_time('mysql')); $taxo = get_the_terms($post_id, 'question_label'); $result = array('status' => true, 'message' => __('Question label updated.', 'ap'), 'html' => ap_get_question_label($post_id, true)); } else { $result = array('status' => false, 'message' => __('No label selected', 'ap')); } } else { $result = array('status' => false, 'message' => __('Unable to set labels, please try again', 'ap')); } die(json_encode($result)); }
?> <!-- Start labels --> <div class="ap-question-side"> <h3 class="ap-question-side-title"> <?php _e('Labels', 'ap'); ?> <?php ap_change_label_html(get_question_id()); ?> </h3> <div data-view="ap-labels-list"> <?php echo ap_get_question_label(get_question_id(), true); ?> </div> </div> <!-- End labels --> <!-- Start Category --> <?php if (ap_opt('enable_categories')) { ?> <div class="ap-question-side"> <h3 class="ap-question-side-title"><?php _e('Categories', 'ap'); ?> </h3> <?php
<?php echo get_avatar(get_the_author_meta('ID'), 35); ?> </a> </div> <div class="summery wrap-left"> <h3 class="question-title"> <a class="question-hyperlink" href="<?php the_permalink(); ?> " rel="bookmark"><?php the_title(); ?> </a> <?php echo ap_get_question_label(null, true); ?> </h3> <ul class="list-taxo ap-inline-list clearfix"> <?php if ($post->selected) { ?> <li class="ap-tip ap-ansslable" title="<?php _e('Answer is accepted', 'ap'); ?> "> <i class="ap-icon-answer"></i> </li> <?php } ?>
public function custom_columns_value($column) { global $post; if ('asker' == $column || 'answerer' == $column) { echo get_avatar(get_the_author_meta('user_email'), 40); } elseif (ANSPRESS_CAT_TAX == $column) { /* Get the genres for the post. */ $category = get_the_terms($post->ID, ANSPRESS_CAT_TAX); /* If terms were found. */ if (!empty($category)) { $out = array(); /* Loop through each term, linking to the 'edit posts' page for the specific term. */ foreach ($category as $cat) { $out[] = edit_term_link($cat->name, '', '', $cat, false); } /* Join the terms, separating them with a comma. */ echo join(', ', $out); } else { _e('--'); } } elseif (ANSPRESS_TAG_TAX == $column) { /* Get the genres for the post. */ $terms = get_the_terms($post->ID, ANSPRESS_TAG_TAX); /* If terms were found. */ if (!empty($terms)) { $out = array(); /* Loop through each term, linking to the 'edit posts' page for the specific term. */ foreach ($terms as $term) { $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, ANSPRESS_TAG_TAX => $term->slug), 'edit.php')), esc_html(sanitize_term_field('name', $term->name, $term->term_id, ANSPRESS_TAG_TAX, 'display'))); } /* Join the terms, separating them with a comma. */ echo join(', ', $out); } else { _e('No Tags'); } } elseif ('answers' == $column) { /* Get the genres for the post. */ $an_count_args = array('post_type' => 'answer', 'post_status' => 'publish', 'post_parent' => $post->ID, 'showposts' => -1); $a_count = count(get_posts($an_count_args)); /* If terms were found. */ if (!empty($a_count)) { echo '<a class="ans-count" title="' . $a_count . __('answers', 'ap') . '" href="' . esc_url(add_query_arg(array('post_type' => 'answer', 'post_parent' => $post->ID), 'edit.php')) . '">' . $a_count . '</a>'; } else { echo '<a class="ans-count" title="0' . __('answers', 'ap') . '">0</a>'; } } elseif ('parent_question' == $column) { echo '<a class="parent_question" href="' . esc_url(add_query_arg(array('post' => $post->post_parent, 'action' => 'edit'), 'post.php')) . '"><strong>' . get_the_title($post->post_parent) . '</strong></a>'; } elseif ('status' == $column) { echo '<span class="question-status">' . ap_get_question_label() . '</span>'; } elseif ('vote' == $column) { echo '<span class="vote-count' . ($post->flag ? ' zero' : '') . '">' . $post->net_vote . '</span>'; } elseif ('flag' == $column) { echo '<span class="flag-count' . ($post->flag ? ' flagged' : '') . '">' . $post->flag . '</span>'; } }