Skip to content

Instantly share code, notes, and snippets.

@rambuvn
Created May 5, 2014 07:58
Show Gist options
  • Save rambuvn/94e31fe6fe64f6d11d9c to your computer and use it in GitHub Desktop.
Save rambuvn/94e31fe6fe64f6d11d9c to your computer and use it in GitHub Desktop.
<?php get_header('dwqa'); ?>
<?php do_action( 'dwqa_before_page' ) ?>
<?php if (is_user_logged_in()) : ?>
<div id="submit-question" class="dwqa-submit-question">
<?php
global $dwqa_options, $dwqa_current_error;
if( is_wp_error( $dwqa_current_error ) ) {
$error_messages = $dwqa_current_error->get_error_messages();
if( !empty($error_messages) ) {
echo '<div class="alert alert-error">';
foreach ($error_messages as $message) {
echo $message;
}
echo '</div>';
}
}
?>
<form action="" name="dwqa-submit-question-form" id="dwqa-submit-question-form" method="post">
<div class="question-form-fields">
<div class="question-meta">
<div class="row">
<div class="select-category col-sm-6">
<label for="question-category"><?php _e('I have question about','dwqa') ?></label>
<?php
wp_dropdown_categories( array(
'name' => 'question-category',
'id' => 'question-category',
'taxonomy' => 'dwqa-question_category',
'class' => 'input-block-level',
'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' )
) );
?>
</div>
<div class="input-tag col-sm-6">
<label for="question-tag"><?php _e('With product','dwqa') ?></label>
<?php
$exclude_tags = get_term_by( 'name', 'FAQ', 'dwqa-question_tag' );
$exclude_tags_id = array();
if( ! empty($exclude_tags) ) {
$exclude_tags_id[] = $exclude_tags->term_id;
}
wp_dropdown_categories( array(
'name' => 'question-tag',
'id' => 'question-tag',
'taxonomy' => 'dwqa-question_tag',
'hide_empty' => 0,
'selected' => 'Other',
'class' => 'input-block-level',
'exclude' => $exclude_tags_id,
'hierarchical' => 1,
'value' => 'name',
'walker' => new dwqa_question_tag_walker()
) );
?>
</div>
</div>
</div>
<div class="input-title">
<label for="question-title"><?php _e('My question is','dwqa') ?></label>
<input type="text" name="question-title" id="question-title" class="input-block-level" placeholder="<?php _e('How to...','dwqa') ?>" autocomplete="off" data-nonce="<?php echo wp_create_nonce( '_dwqa_filter_nonce' ) ?>" />
<span class="dwqa-search-loading hide"></span>
<span class="dwqa-search-clear fa fa-times hide"></span>
</div>
<div class="input-content">
<label for="question-content"><?php _e('More details','dwqa') ?></label>
<?php dwqa_init_tinymce_editor( array( 'id' => 'dwqa-question-content-editor', 'textarea_name' => 'question-content' ) ); ?>
</div>
<div class="checkbox-private">
<label for="private-message"><input type="checkbox" name="private-message" id="private-message" value="true"> <?php _e('Post this Question as Private.','dwqa') ?> <i class="fa fa-question-circle" title="<?php _e(' Only we and you can read the question. No one else can!', 'dwqa') ?>"></i></label>
</div>
<div class="question-signin">
<?php do_action( 'dwqa_submit_question_ui' ); ?>
</div>
</div>
<div class="form-submit">
<input type="submit" value="<?php _e('Ask Question','dwqa') ?>" class="btn btn-success btn-submit-question" />
</div>
</form>
</div>
<?php else : ?>
<div class="alert">Please <a data-toggle="modal" class="open-login-modal" href="#loginModal" alt="signin-tab">Login</a> or <a data-toggle="modal" class="open-login-modal" href="#loginModal" alt="signup-tab">Register</a> before submit question</div>
<?php endif; ?>
<?php do_action( 'dwqa_after_page' ) ?>
<?php get_footer('dwqa'); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment