post_status == 'private_post' ? true : false; } // Ask form arguments. $args = array( 'name' => 'ask_form', 'is_ajaxified' => true, 'multipart' => true, //'attr' => ' data-before="apShowSimilarQuestions"', 'submit_button' => ($editing ? __( 'Update question', 'anspress-question-answer' ) : __( 'Post question', 'anspress-question-answer' )), 'fields' => array( array( 'name' => 'title', 'label' => __( 'Title', 'anspress-question-answer' ), 'type' => 'text', 'placeholder' => __( 'Question in one sentence', 'anspress-question-answer' ), 'desc' => __( 'Write a meaningful title for the question.', 'anspress-question-answer' ), 'value' => ( $editing ? $editing_post->post_title : sanitize_text_field( @$_POST['title'] ) ), 'order' => 5, 'attr' => 'data-action="suggest_similar_questions"', 'autocomplete' => false, ), array( 'name' => 'title', 'type' => 'custom', 'order' => 5, 'html' => '
', ), array( 'name' => 'description', 'label' => __( 'Description', 'anspress-question-answer' ), 'type' => 'editor', 'desc' => __( 'Write description for the question.', 'anspress-question-answer' ), 'value' => ( $editing ? apply_filters( 'the_content', $editing_post->post_content ) : @$_POST['description'] ), 'settings' => apply_filters( 'ap_ask_form_editor_settings', array( 'textarea_rows' => 8, 'tinymce' => ap_opt( 'question_text_editor' ) ? false : true, 'quicktags' => ap_opt( 'question_text_editor' ) ? true : false, 'media_buttons' => false, )), ), array( 'name' => 'ap_upload', 'type' => 'custom', 'html' => ap_post_upload_form(), 'order' => 10, ), array( 'name' => 'parent_id', 'type' => 'hidden', 'value' => ( $editing ? $editing_post->post_parent : get_query_var( 'parent' ) ), 'order' => 20, ), ), ); // Add name fields if anonymous is allowed. if ( ! is_user_logged_in() && ap_opt( 'allow_anonymous' ) ) { $args['fields'][] = array( 'name' => 'name', 'label' => __( 'Name', 'anspress-question-answer' ), 'type' => 'text', 'placeholder' => __( 'Enter your name to display', 'anspress-question-answer' ), 'value' => sanitize_text_field( @$_POST['name'] ), 'order' => 12, ); } // Add private field checkbox if enabled. if ( ap_opt( 'allow_private_posts' ) ) { $args['fields'][] = array( 'name' => 'is_private', 'type' => 'checkbox', 'desc' => __( 'Only visible to admin and moderator.', 'anspress-question-answer' ), 'value' => $is_private, 'order' => 12, 'show_desc_tip' => false, ); } if ( ap_show_captcha_to_user() ) { // Show recpatcha if key exists and enabled. if ( ap_opt( 'recaptcha_site_key' ) == '' ) { $reCaptcha_html = '