is_block_editor( false ); if ( is_multisite() ) { add_action( 'admin_footer', '_admin_notice_post_locked' ); } else { $check_users = get_users( array( 'fields' => 'ID', 'number' => 2, ) ); if ( count( $check_users ) > 1 ) { add_action( 'admin_footer', '_admin_notice_post_locked' ); } unset( $check_users ); } wp_enqueue_script( 'post' ); $_wp_editor_expand = false; $_content_editor_dfw = false; /** * Filters whether to enable the 'expand' functionality in the post editor. * * @since 4.0.0 * @since 4.1.0 Added the `$post_type` parameter. * * @param bool $expand Whether to enable the 'expand' functionality. Default true. * @param string $post_type Post type. */ if ( post_type_supports( $post_type, 'editor' ) && ! wp_is_mobile() && ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) && apply_filters( 'wp_editor_expand', true, $post_type ) ) { wp_enqueue_script( 'editor-expand' ); $_content_editor_dfw = true; $_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' ); } if ( wp_is_mobile() ) { wp_enqueue_script( 'jquery-touch-punch' ); } /** * Post ID global * * @name $post_ID * @var int */ $post_ID = isset( $post_ID ) ? (int) $post_ID : 0; $user_ID = isset( $user_ID ) ? (int) $user_ID : 0; $action = isset( $action ) ? $action : ''; if ( get_option( 'page_for_posts' ) == $post_ID && empty( $post->post_content ) ) { add_action( 'edit_form_after_title', '_wp_posts_page_notice' ); remove_post_type_support( $post_type, 'editor' ); } $thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ); if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) { if ( wp_attachment_is( 'audio', $post ) ) { $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' ); } elseif ( wp_attachment_is( 'video', $post ) ) { $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); } } if ( $thumbnail_support ) { add_thickbox(); wp_enqueue_media( array( 'post' => $post_ID ) ); } // Add the local autosave notice HTML. add_action( 'admin_footer', '_local_storage_notice' ); /* * @todo Document the $messages array(s). */ $permalink = get_permalink( $post_ID ); if ( ! $permalink ) { $permalink = ''; } $messages = array(); $preview_post_link_html = ''; $scheduled_post_link_html = ''; $view_post_link_html = ''; $preview_page_link_html = ''; $scheduled_page_link_html = ''; $view_page_link_html = ''; $preview_url = get_preview_post_link( $post ); $viewable = is_post_type_viewable( $post_type_object ); if ( $viewable ) { // Preview post link. $preview_post_link_html = sprintf( ' %2$s', esc_url( $preview_url ), __( 'Preview post' ) ); // Scheduled post preview link. $scheduled_post_link_html = sprintf( ' %2$s', esc_url( $permalink ), __( 'Preview post' ) ); // View post link. $view_post_link_html = sprintf( ' %2$s', esc_url( $permalink ), __( 'View post' ) ); // Preview page link. $preview_page_link_html = sprintf( ' %2$s', esc_url( $preview_url ), __( 'Preview page' ) ); // Scheduled page preview link. $scheduled_page_link_html = sprintf( ' %2$s', esc_url( $permalink ), __( 'Preview page' ) ); // View page link. $view_page_link_html = sprintf( ' %2$s', esc_url( $permalink ), __( 'View page' ) ); } $scheduled_date = sprintf( /* translators: Publish box date string. 1: Date, 2: Time. */ __( '%1$s at %2$s' ), /* translators: Publish box date format, see https://www.php.net/date */ date_i18n( _x( 'M j, Y', 'publish box date format' ), strtotime( $post->post_date ) ), /* translators: Publish box time format, see https://www.php.net/date */ date_i18n( _x( 'H:i', 'publish box time format' ), strtotime( $post->post_date ) ) ); $messages['post'] = array( 0 => '', // Unused. Messages start at index 1. 1 => __( 'Post updated.' ) . $view_post_link_html, 2 => __( 'Custom field updated.' ), 3 => __( 'Custom field deleted.' ), 4 => __( 'Post updated.' ), /* translators: %s: Date and time of the revision. */ 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Post restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => __( 'Post published.' ) . $view_post_link_html, 7 => __( 'Post saved.' ), 8 => __( 'Post submitted.' ) . $preview_post_link_html, /* translators: %s: Scheduled date for the post. */ 9 => sprintf( __( 'Post scheduled for: %s.' ), '' . $scheduled_date . '' ) . $scheduled_post_link_html, 10 => __( 'Post draft updated.' ) . $preview_post_link_html, ); $messages['page'] = array( 0 => '', // Unused. Messages start at index 1. 1 => __( 'Page updated.' ) . $view_page_link_html, 2 => __( 'Custom field updated.' ), 3 => __( 'Custom field deleted.' ), 4 => __( 'Page updated.' ), /* translators: %s: Date and time of the revision. */ 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Page restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => __( 'Page published.' ) . $view_page_link_html, 7 => __( 'Page saved.' ), 8 => __( 'Page submitted.' ) . $preview_page_link_html, /* translators: %s: Scheduled date for the page. */ 9 => sprintf( __( 'Page scheduled for: %s.' ), '' . $scheduled_date . '' ) . $scheduled_page_link_html, 10 => __( 'Page draft updated.' ) . $preview_page_link_html, ); $messages['attachment'] = array_fill( 1, 10, __( 'Media file updated.' ) ); // Hack, for now. /** * Filters the post updated messages. * * @since 3.0.0 * * @param array[] $messages Post updated messages. For defaults see `$messages` declarations above. */ $messages = apply_filters( 'post_updated_messages', $messages ); $message = false; if ( isset( $_GET['message'] ) ) { $_GET['message'] = absint( $_GET['message'] ); if ( isset( $messages[ $post_type ][ $_GET['message'] ] ) ) { $message = $messages[ $post_type ][ $_GET['message'] ]; } elseif ( ! isset( $messages[ $post_type ] ) && isset( $messages['post'][ $_GET['message'] ] ) ) { $message = $messages['post'][ $_GET['message'] ]; } } $notice = false; $form_extra = ''; if ( 'auto-draft' == $post->post_status ) { if ( 'edit' == $action ) { $post->post_title = ''; } $autosave = false; $form_extra .= ""; } else { $autosave = wp_get_post_autosave( $post_ID ); } $form_action = 'editpost'; $nonce_action = 'update-post_' . $post_ID; $form_extra .= ""; // Detect if there exists an autosave newer than the post and if that autosave is different than the post. if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) { if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { $notice = sprintf( /* translators: %s: URL to view the autosave. */ __( 'There is an autosave of this post that is more recent than the version below. View the autosave' ), get_edit_post_link( $autosave->ID ) ); break; } } // If this autosave isn't different from the current post, begone. if ( ! $notice ) { wp_delete_post_revision( $autosave->ID ); } unset( $autosave_field, $_autosave_field ); } $post_type_object = get_post_type_object( $post_type ); // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). require_once ABSPATH . 'wp-admin/includes/meta-boxes.php'; register_and_do_post_meta_boxes( $post ); add_screen_option( 'layout_columns', array( 'max' => 2, 'default' => 2, ) ); if ( 'post' == $post_type ) { $customize_display = '

' . __( 'The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.' ) . '

'; get_current_screen()->add_help_tab( array( 'id' => 'customize-display', 'title' => __( 'Customizing This Display' ), 'content' => $customize_display, ) ); $title_and_editor = '

' . __( 'Title — Enter a title for your post. After you enter a title, you’ll see the permalink below, which you can edit.' ) . '

'; $title_and_editor .= '

' . __( 'Post editor — Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.' ) . '

'; $title_and_editor .= '

' . __( 'Visual mode gives you an editor that is similar to a word processor. Click the Toolbar Toggle button to get a second row of controls.' ) . '

'; $title_and_editor .= '

' . __( 'The Text mode allows you to enter HTML along with your post text. Note that <p> and <br> tags are converted to line breaks when switching to the Text editor to make it less cluttered. When you type, a single line break can be used instead of typing <br>, and two line breaks instead of paragraph tags. The line breaks are converted back to tags automatically.' ) . '

'; $title_and_editor .= '

' . __( 'You can insert media files by clicking the button above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.' ) . '

'; $title_and_editor .= '

' . __( 'You can enable distraction-free writing mode using the icon to the right. This feature is not available for old browsers or devices with small screens, and requires that the full-height editor be enabled in Screen Options.' ) . '

'; $title_and_editor .= '

' . __( 'Keyboard users: When you’re working in the visual editor, you can use Alt + F10 to access the toolbar.' ) . '

'; get_current_screen()->add_help_tab( array( 'id' => 'title-post-editor', 'title' => __( 'Title and Post Editor' ), 'content' => $title_and_editor, ) ); get_current_screen()->set_help_sidebar( '

' . sprintf( /* translators: %s: URL to Press This bookmarklet. */ __( 'You can also create posts with the Press This bookmarklet.' ), 'tools.php' ) . '

' . '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Writing and Editing Posts' ) . '

' . '

' . __( 'Support' ) . '

' ); } elseif ( 'page' == $post_type ) { $about_pages = '

' . __( 'Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.' ) . '

' . '

' . __( 'Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.' ) . '

'; get_current_screen()->add_help_tab( array( 'id' => 'about-pages', 'title' => __( 'About Pages' ), 'content' => $about_pages, ) ); get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Adding New Pages' ) . '

' . '

' . __( 'Documentation on Editing Pages' ) . '

' . '

' . __( 'Support' ) . '

' ); } elseif ( 'attachment' == $post_type ) { get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

' . __( 'This screen allows you to edit fields for metadata in a file within the media library.' ) . '

' . '

' . __( 'For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.' ) . '

' . '

' . __( 'Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.' ) . '

' . '

' . __( 'Remember to click Update Media to save metadata entered or changed.' ) . '

', ) ); get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Edit Media' ) . '

' . '

' . __( 'Support' ) . '

' ); } if ( 'post' == $post_type || 'page' == $post_type ) { $inserting_media = '

' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the “Create a new gallery” button.' ) . '

'; $inserting_media .= '

' . __( 'You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. Learn more about embeds.' ) . '

'; get_current_screen()->add_help_tab( array( 'id' => 'inserting-media', 'title' => __( 'Inserting Media' ), 'content' => $inserting_media, ) ); } if ( 'post' == $post_type ) { $publish_box = '

' . __( 'Several boxes on this screen contain settings for how your content will be published, including:' ) . '

'; $publish_box .= ''; get_current_screen()->add_help_tab( array( 'id' => 'publish-box', 'title' => __( 'Publish Settings' ), 'content' => $publish_box, ) ); $discussion_settings = '

' . __( 'Send Trackbacks — Trackbacks are a way to notify legacy blog systems that you’ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they’ll be notified automatically using pingbacks, and this field is unnecessary.' ) . '

'; $discussion_settings .= '

' . __( 'Discussion — You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.' ) . '

'; get_current_screen()->add_help_tab( array( 'id' => 'discussion-settings', 'title' => __( 'Discussion Settings' ), 'content' => $discussion_settings, ) ); } elseif ( 'page' == $post_type ) { $page_attributes = '

' . __( 'Parent — You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.' ) . '

' . '

' . __( 'Template — Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.' ) . '

' . '

' . __( 'Order — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.' ) . '

'; get_current_screen()->add_help_tab( array( 'id' => 'page-attributes', 'title' => __( 'Page Attributes' ), 'content' => $page_attributes, ) ); } require_once ABSPATH . 'wp-admin/admin-header.php'; ?>

cap->create_posts ) ) { echo ' ' . esc_html( $post_type_object->labels->add_new ) . ''; } ?>

>
public ? get_sample_permalink_html( $post->ID ) : ''; // As of 4.4, the Get Shortlink button is hidden by default. if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) { $shortlink = wp_get_shortlink( $post->ID, 'post' ); if ( ! empty( $shortlink ) && $shortlink !== $permalink && home_url( '?page_id=' . $post->ID ) !== $permalink ) { $sample_permalink_html .= ''; } } if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status; ?>
post_content, 'content', array( '_content_editor_dfw' => $_content_editor_dfw, 'drag_drop_upload' => true, 'tabfocus_elements' => 'content-html,save-post', 'editor_height' => 300, 'tinymce' => array( 'resize' => false, 'wp_autoresize_on' => $_wp_editor_expand, 'add_unload_trigger' => false, 'wp_keep_scroll_position' => ! $is_IE, ), ) ); ?>
0' ); ?>   post_status ) { echo ''; $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ); if ( $last_user ) { /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time. */ printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); } else { /* translators: 1: Post edited date, 2: Post edited time. */ printf( __( 'Last edited on %1$s at %2$s' ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); } echo ''; } ?>

post_title ) : ?>