Guest User

Untitled

a guest
Feb 21st, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. add_filter('dwqa_ask_form_tag_output','dwqa_ask_form_tag_output',10,1);
  2. function dwqa_ask_form_tag_output($output){
  3. $args=array(
  4. 'orderby' => 'count',
  5. 'order' => 'DESC',
  6. 'hide_empty' => false,
  7. );
  8.  
  9. $tag_terms=get_terms('dwqa-question_tag', $args );
  10. $output='<select required multiple="multiple" name="question-tag"
  11. id="question-tag" class="select-tag">';
  12. $output.='<option value="">Tags to be selected</option>';
  13. foreach($tag_terms as $tag_term)
  14. $output.='<option value="'.$tag_term->name.'">'.$tag_term->name.'</option>';
  15. $output.='</select>';
  16. return $output;
  17. }
  18.  
  19. $tag_value=isset( $_POST['question-tag'] ) ? esc_html( $_POST['question-tag'] ) : '';
  20. $tag_input='<input type="text" name="question-tag[]" id="question-tag" value="'.$tag_value.'" />';
  21. $tag_input=apply_filters('dwqa_ask_form_tag_output',$tag_input);
  22. echo $tag_input;
Add Comment
Please, Sign In to add comment