Dhananjay Satanure
asked 6 years ago

How can I delete both Category & tag section, on “Submit Question” Page?

5 Answers
DominicStaff
answered 6 years ago

You can open the question-submit-form.php file and find/remove the following code: 

<p>
<label for="question-category"><?php _e( 'Category', 'dwqa' ) ?></label>
<?php
wp_dropdown_categories( array(
'name' => 'question-category',
'id' => 'question-category',
'taxonomy' => 'dwqa-question_category',
'show_option_none' => __( 'Select question category', 'dwqa' ),
'hide_empty' => 0,
'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' ),
'selected' => isset( $_POST['question-category'] ) ? sanitize_text_field( $_POST['question-category'] ) : false,
) );
?>
</p>
<p>
<label for="question-tag"><?php _e( 'Tag', 'dwqa' ) ?></label>
<?php $tags = isset( $_POST['question-tag'] ) ? sanitize_text_field( $_POST['question-tag'] ) : ''; ?>
<input type="text" class="" name="question-tag" value="<?php echo $tags ?>" >
</p>
Dávid Kusztor
answered 5 years ago

Hi,
I delete this code but got the following result:

DWQA Ask Question


I think something not okay 🙂

Dávid Kusztor
answered 5 years ago

Okay, I noted, that I you can’t see because I try to solve. so.

I uploaded image:
 

Dávid Kusztor
answered 5 years ago

If the php file contain this code it works:

Start your code here <?php
/**
* The template for displaying single answers
*
* @package DW Question & Answer
* @since DW Question & Answer 1.4.3
*/
?>
<?php if ( dwqa_current_user_can( 'post_question' ) ) : ?>
<?php do_action( 'dwqa_before_question_submit_form' ); ?>
<form method="post" class="dwqa-content-edit-form" enctype="multipart/form-data">
<p class="dwqa-search">
<label for="question_title"><?php _e( 'Title', 'dw-question-answer' ) ?></label>
<?php $title = isset( $_POST['question-title'] ) ? sanitize_title( $_POST['question-title'] ) : ''; ?>
<input type="text" data-nonce="<?php echo wp_create_nonce( '_dwqa_filter_nonce' ) ?>" id="question-title" name="question-title" value="<?php echo $title ?>" tabindex="1">
</p>
<?php $content = isset( $_POST['question-content'] ) ? sanitize_text_field( $_POST['question-content'] ) : ''; ?>
<p><?php dwqa_init_tinymce_editor( array( 'content' => $content, 'textarea_name' => 'question-content', 'id' => 'question-content' ) ) ?></p>
<?php global $dwqa_general_settings; ?>
<?php if ( isset( $dwqa_general_settings['enable-private-question'] ) && $dwqa_general_settings['enable-private-question'] ) : ?>
<p>
<label for="question-status"><?php _e( 'Status', 'dw-question-answer' ) ?></label>
<select class="dwqa-select" id="question-status" name="question-status">
<optgroup label="<?php _e( 'Who can see this?', 'dw-question-answer' ) ?>">
<option value="publish"><?php _e( 'Public', 'dw-question-answer' ) ?></option>
<option value="private"><?php _e( 'Only Me &amp; Admin', 'dw-question-answer' ) ?></option>
</optgroup>
</select>
</p>
<?php endif; ?>
<p>

<?php if ( dwqa_current_user_can( 'post_question' ) && !is_user_logged_in() ) : ?>
</p>
<p>
<label for="_dwqa_anonymous_email"><?php _e( 'Your Email', 'dw-question-answer' ) ?></label>
<?php $email = isset( $_POST['_dwqa_anonymous_email'] ) ? sanitize_email( $_POST['_dwqa_anonymous_email'] ) : ''; ?>
<input type="email" class="" name="_dwqa_anonymous_email" value="<?php echo $email ?>" >
</p>
<p>
<label for="_dwqa_anonymous_name"><?php _e( 'Your Name', 'dw-question-answer' ) ?></label>
<?php $name = isset( $_POST['_dwqa_anonymous_name'] ) ? sanitize_text_field( $_POST['_dwqa_anonymous_name'] ) : ''; ?>
<input type="text" class="" name="_dwqa_anonymous_name" value="<?php echo $name ?>" >
</p>
<?php endif; ?>
<?php wp_nonce_field( '_dwqa_submit_question' ) ?>
<?php dwqa_load_template( 'captcha', 'form' ); ?>
<?php do_action('dwqa_before_question_submit_button'); ?>
<input type="submit" name="dwqa-question-submit" value="<?php _e( 'Submit', 'dw-question-answer' ) ?>" >
</form>
<?php do_action( 'dwqa_after_question_submit_form' ); ?>
<?php else : ?>
<div class="alert"><?php _e( 'You do not have permission to submit a question','dw-question-answer' ) ?></div>
<?php endif; ?>

 
 

DominicStaff
answered 5 years ago

I have checked your code and see that you have some error when removing the code, you can use the following code, I have helped you remove the categories and tag section: 
CODE: http://snippi.com/s/1jdmtq3

Powered by DW Question & Answer Pro