Is it possible to add tags for answers?
@jmoon: have a look at the wp-content/plugins/tags-for-anspress/tags-for-anspress.php file.
In there you’ll finde the following hooks:
add_action('ap_ask_form_fields', array($this, 'ask_from_tag_field'), 10, 2); add_action('ap_ask_fields_validation', array($this, 'ap_ask_fields_validation')); add_action( 'ap_processed_new_question', array($this, 'after_new_question'), 0, 2 ); add_action( 'ap_processed_update_question', array($this, 'after_new_question'), 0, 2 );
Simply copy & paste those and the corresponding functions. To make a clear separation between questions & answers, make sure you also copy & rename the function names. I’ve done it like the following:
add_action('ap_answer_form_fields', array($this, 'answer_form_tag_field'), 10, 2); add_action('ap_answer_fields_validation', array($this, 'ap_answer_fields_validation')); add_action( 'ap_processed_new_answer', array($this, 'after_new_answer'), 0, 2 ); add_action( 'ap_processed_update_answer', array($this, 'after_new_answer'), 0, 2 );
Also, If you would like to make selecting tags optional you have to remove the ap_ask_fields_validation or the ap_answer_fields_validation hooks.
atultiwari (Buyer) commented
@Rahul, I just noticed, (from above code snippet) you have written “ask_from_tag_field” in the first line instead of “ask_FORM….”. Is it typo or intentional?
Thank you for help!
By the way, we are really sorry but we are not sure which field to copy and where to paste.
What is the answer form hook? Please show how to do it.
Thanks a lot.