I can't edit the ask a question page. How can I add my phone number or other information to the form?
Phone Number?
City?
What should the "question-submit-form.php" form be like? And Will the form not change when the extension is updated?
We will customize the template and will provide a example to you as soon as possible.
1/ To add custom fields to the submit question form, you can add the following code to the submit-question-form.php file line 79:
<p>
<!-- // add new fields -->
<label for="question-phone"><?php _e( 'phone', 'emqa' ) ?></label>
<?php $phone = isset( $_POST['question-phone'] ) ? $_POST['question-phone'] : ''; ?>
<input type="text" class="emqa-question-phones" name="question-phone" value="<?php echo $phone ?>" >
</p>
<p>
<label for="question-city"><?php _e( 'city', 'emqa' ) ?></label>
<?php $city = isset( $_POST['question-city'] ) ? $_POST['question-city'] : ''; ?>
<input type="text" class="emqa-question-city" name="question-city" value="<?php echo $city ?>" >
</p>
2/ Add this code to the inc/Handle.php file (line 500):
$phone= isset( $_POST['question-phone'] ) ? $_POST['question-phone'] : '';
$city = isset( $_POST['question-address'] ) ? $_POST['question-address'] : '';
And under line 578:
update_post_meta( $new_question, '_emqa_question_phone', $phone );
update_post_meta( $new_question, '_emqa_question_city', $city );
3/ To show the data in the single question, you can open the content-single-question.php file and add the following code to the position that you wish:
<?php
$phone = get_post_meta( get_the_ID(), '_emqa_question_phone', true );
echo 'Job: '. $phone;
?>
<?php
$city = get_post_meta( get_the_ID(), '_emqa_question_city', true );
echo 'City: '. $city;
?>
Please login or Register to submit your answer