Laurent Alquier
asked 4 years ago

Is it possible to set a Question category by default in the New Question form?

I would like the selection to be set to ‘Questions’ by default instead of ‘Select a category’,

1 Answers
DominicStaff
answered 4 years ago

To set a question category by default, you can 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: http://snippi.com/s/b3p4x1w

Then find the line 41:
'selected' => isset( $_POST['question-category'] ) ? $_POST['question-category'] : false,

Replace with the following code:
'selected' => Your Categories ID

Note: You can find your categories ID In backend, when you edit a category, you will see your category ID in the URL on your browser address bar which looks like this: …&tag_ID=

Hope this helps!

Biorexo
replied 3 months ago

Hello Dominic, i would liek to set pain relief category as my default category, is there one piece of code that you could post into my website biorexo.com for me please ? I see the code above but the instructions are very complicated for me

Dominic Staff
replied 3 months ago

I have helped you show the default categories in the question submit form, you can open the question-submit-form.php. to change the categories id that you want to show.
To find the categories Id, you can open the Dashboard > Questions > Categories > edit the categories and the ID will show on the browser address bar.
see the screenshot: https://prnt.sc/q5cl1w

Or let me know the categories that you want to show, I will help you fix this issue.

Biorexo
replied 3 months ago

thank you, yes the default category is correct but the slug in the permalink is not showing, http://www.biorexo.com/pain-relief/uncategorized/test-14/

Dominic Staff
replied 3 months ago

In this case, you should use the shortcode to show submit question categories form, we have included this shortcode for the Pro version.
You can check the following page: http://www.biorexo.com/wp-admin/post.php?post=4083&action=edit

Biorexo
replied 3 months ago

thank you

Biorexo
replied 3 months ago

hey Dominic, for some reason biorexo is being repeated in my designwall url, see example; http://www.biorexo.com/biorexo-ask-question-how-to/ and http://www.biorexo.com/biorexo-how-to-questions/ …..can you please remove the “/biorexo-” ?

Dominic Staff
replied 3 months ago

Are you want to remove the /biorexo from the URL that you have submitted here. Right?

Biorexo
replied 2 months ago

Hi Dominic, the category is defaulted as requested but when i want to ask a question and select another category the remaining dropdown categories are not available to select, please can you find a workable solution for a default category and other categories to be available if selected ?

Powered by DW Question & Answer Pro