bryan alman
asked 5 years ago

Hello,

I want to limit the question length into 60 characters, how should i do that?

1 Answers
DominicStaff
answered 5 years ago

At the moment, you can limit the length of the title question, please open the question-submit-form.php in the folder path "plugins > dw-question-answer > inc > templates > default". Find the line 41 then replace the following code:

    <div class="input-title">
            <label for="question-title"><?php _e( 'Your question', 'dwqa' ) ?> *</label>
            <input type="text" name="question-title" id="question-title" placeholder="<?php _e( 'How to...', 'dwqa' ) ?>" autocomplete="off" data-nonce="<?php echo wp_create_nonce( '_dwqa_filter_nonce' ) ?>" value="<?php echo isset( $_POST['question-title'] ) ? esc_html( $_POST['question-title'] ) : ''; ?>" />
            <span class="dwqa-search-loading dwqa-hide"></span>
            <span class="dwqa-search-clear fa fa-times dwqa-hide"></span>
        </div> 

With new code:

<div class="input-title">
<label for="question-title"><?php _e('Your question.','dwqa') ?> This is just the title of your question</label>
<input type="text" name="question-title" id="question-title" placeholder="<?php _e('Question Title. Limit to 75 characters','dwqa') ?>" autocomplete="off" data-nonce="<?php echo wp_create_nonce( '_dwqa_filter_nonce' ) ?>" maxlength="75" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script&gt;
<script src="../wp-content/plugins/dw-question-answer/assets/js/jquery.maxlength.js"></script>
<script src="../wp-content/plugins/dw-question-answer/assets/js/main.js"></script> <span class="dwqa-search-loading hide"></span>
<span class="dwqa-search-clear icon-remove hide"></span>
</div>

Hope this helps !

Powered by DW Question & Answer Pro