Constantine Karnaukhov
asked 9 years ago

Hello,

I want to bind the tag to the category in DW Question & Answer. So when user selects category, he was suggested to select a list of relevant tags. Is this really to implement?!

Sorry for my bad english.

Mauro Paravano
replied 8 years ago

Hi Constantine,
I hope you resolve this issue… Do you mind giving me a hand with this? I’m trying to do the same thing with tags.

thanks!

1 Answers
DominicStaff
answered 8 years ago

To display tag as drop downlist like categories in ask question, go to your theme folder and create a new folder , named it "dwqa-templates" .
Inside your new folder, create a new file: “question-submit-form.php”.
Now, open up the new file in notepad or any code editor, and copy/paste the code at this link:
URL: http://snippi.com/s/j48zs9y
Finally, add the following code to the functions.php file.

add_filter('dwqa_ask_form_tag_output','dwqa_ask_form_tag_output',10,1);

function dwqa_ask_form_tag_output($output){

 $args=array(

 'orderby' => 'count',

 'order' => 'DESC',

 'hide_empty' => false,

 );

 $tag_terms=get_terms('dwqa-question_tag', $args ) ;

 $output='<select name="question-tag" id="question-tag" class="postform">';

 $output.='<option value="">Select question Tags</option>';

 foreach($tag_terms as $tag_term)

 $output.='<option value="'.$tag_term->name.'">'.$tag_term->name.'</option>';

 $output.='</select>';

 return $output;

}

Hope this helps

Mauro Paravano
replied 8 years ago

Hi,
I was trying to do this, but I have now the following msg when trying to submit a new question:
Parse error: syntax error, unexpected ‘8.’ (T_DNUMBER) in /homepages/7/d616545537/htdocs/clickandbuilds/ProJetMe/wp-content/themes/Divi/dwqa-templates/question-submit-form.php on line 14

Can you help?

Dominic Staff
replied 8 years ago

Please send me username & password of your site for further checking, I will help you resolve it.

Nagarjun Sarathy
replied 7 years ago

The above solution seems to work for single select from dropdown. How do I apply it for multi select of options and return the values to dwqa_ask_form_tag_output?

Dominic Staff
replied 7 years ago

At the moment, the plugin does not support to make multi-select option for the tags list.

Powered by DW Question & Answer Pro