amambosmon
asked 5 years ago

Can you help me, how to give limit for length of slug question.
For example : i want to give limit length url for 15 word, for any question.
Or give limit for 80 character.

1 Answers
DominicStaff
answered 5 years ago

At the moment, the plugin does not support to limit the length of the slug question. However, I think you should limit the Question title when submitting a question.
If you want to limit the title, you can open the question-submit-form.php file in the templates/styles/default folder then replace the line code 17 to 22 with the following code:

<form method="post" class="dwqa-content-ask-form" id="form_elem">
<p class="dwqa-search">
<label for="question_title"><?php _e( 'Title', 'dwqa' ) ?></label>
<?php $title = isset( $_POST['question-title'] ) ? $_POST['question-title'] : ''; ?>
<input type="text" data-nonce="<?php echo wp_create_nonce( '_dwqa_filter_nonce' ) ?>" id="question-title" maxlength="70" name="question-title" value="<?php echo $title ?>" tabindex="1">
<span id="error_msg" style="color:red"></span>
<script type="text/javascript">
$("#validate").click(function(){
var inputStr = $("#question-title").val();
if(inputStr.length<70)
$("#error_msg").html("enter atleast 5 chars in the input box");
else
$("#form_elem").submit();
})
</script>
</p>
Dominic Staff
replied 5 years ago

If you want to custom the plugin and safe in the next update, you can download the following file then add the folder to your theme folder.
URL: https://www.dropbox.com/s/h02ecvenw18vdb0/dwqa-templates.zip?dl=0

Powered by DW Question & Answer Pro