AnsPress_Admin::append_post_status_list()
Description #
Add AnsPress post status to post edit select box.
Source #
File: admin/anspress-admin.php
public static function append_post_status_list() { global $post; $label = ''; if ( in_array( $post->post_type, array( 'question', 'answer' ), true ) ) { if ( 'moderate' === $post->post_status ) { $label = esc_attr__( 'Moderate', 'anspress-question-answer' ); } elseif ( 'private_post' === $post->post_status ) { $label = esc_attr__( 'Private Post', 'anspress-question-answer' ); } echo '<script> jQuery( document ).ready( function() { jQuery( "select#post_status" ).append( "<option value=\'moderate\'' . ( 'moderate' === $post->post_status ? ' selected=\'selected\'' : '' ) . '>' . esc_attr__( 'Moderate', 'anspress-question-answer' ) . '</option>" ); jQuery( "select#post_status" ).append( "<option value=\'private_post\'' . ( 'private_post' === $post->post_status ? ' selected=\'selected\'' : '' ) . '>' . esc_attr__( 'Private Post', 'anspress-question-answer' ) . '</option>" );' . ( ( 'moderate' === $post->post_status || 'private_post' === $post->post_status ) ? 'jQuery( "select#post_status" ).closest( ".misc-pub-section" ).find( "#post-status-display" ).html( "' . esc_html( $label ) . '" );' : '' ) . ' } ); </script>'; } }
Expand full source code Collapse full source code View on GitHub: admin/anspress-admin.php:661
Add your comment