How can I preselect a category for the user?
I have so many categories, it could be inconvenient if let the user to choose the categorie themselves
is there any parameter avaiablel?
Thank you
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!
Thank you for your quick answer, Dominic. But, the fact is,
1. I would like to use different categories on different pages. so how can I call this question-submit-form with different categories within a shortcode?
2. And also, I didn’t find a “theme folder” inside the plugin folder. do you mean, the “template folder” that already exists? in which we have “assets”,”email” and “styles” folders? should I create directly at the root of the template folder?
Thank you
1/ you can use the following shortcode: [dwqa-submit-question-form category=”catslug”]
2/ You can go to wp-content/themes/your-theme and create the dwqa-templates
. folder.
Great, Thanks, it works
Please login or Register to submit your answer