[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/ -> edit-form-advanced.php (source)

   1  <?php
   2  /**
   3   * Post advanced form for inclusion in the administration panels.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  // don't load directly
  10  if ( ! defined( 'ABSPATH' ) ) {
  11      die( '-1' );
  12  }
  13  
  14  /**
  15   * @global string       $post_type
  16   * @global WP_Post_Type $post_type_object
  17   * @global WP_Post      $post             Global post object.
  18   */
  19  global $post_type, $post_type_object, $post;
  20  
  21  // Flag that we're not loading the block editor.
  22  $current_screen = get_current_screen();
  23  $current_screen->is_block_editor( false );
  24  
  25  if ( is_multisite() ) {
  26      add_action( 'admin_footer', '_admin_notice_post_locked' );
  27  } else {
  28      $check_users = get_users(
  29          array(
  30              'fields' => 'ID',
  31              'number' => 2,
  32          )
  33      );
  34  
  35      if ( count( $check_users ) > 1 ) {
  36          add_action( 'admin_footer', '_admin_notice_post_locked' );
  37      }
  38  
  39      unset( $check_users );
  40  }
  41  
  42  wp_enqueue_script( 'post' );
  43  
  44  $_wp_editor_expand   = false;
  45  $_content_editor_dfw = false;
  46  
  47  /**
  48   * Filters whether to enable the 'expand' functionality in the post editor.
  49   *
  50   * @since 4.0.0
  51   * @since 4.1.0 Added the `$post_type` parameter.
  52   *
  53   * @param bool   $expand    Whether to enable the 'expand' functionality. Default true.
  54   * @param string $post_type Post type.
  55   */
  56  if ( post_type_supports( $post_type, 'editor' ) && ! wp_is_mobile() &&
  57      ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) &&
  58      apply_filters( 'wp_editor_expand', true, $post_type ) ) {
  59  
  60      wp_enqueue_script( 'editor-expand' );
  61      $_content_editor_dfw = true;
  62      $_wp_editor_expand   = ( get_user_setting( 'editor_expand', 'on' ) === 'on' );
  63  }
  64  
  65  if ( wp_is_mobile() ) {
  66      wp_enqueue_script( 'jquery-touch-punch' );
  67  }
  68  
  69  /**
  70   * Post ID global
  71   *
  72   * @name $post_ID
  73   * @var int
  74   */
  75  $post_ID = isset( $post_ID ) ? (int) $post_ID : 0;
  76  $user_ID = isset( $user_ID ) ? (int) $user_ID : 0;
  77  $action  = isset( $action ) ? $action : '';
  78  
  79  if ( $post_ID == get_option( 'page_for_posts' ) && empty( $post->post_content ) ) {
  80      add_action( 'edit_form_after_title', '_wp_posts_page_notice' );
  81      remove_post_type_support( $post_type, 'editor' );
  82  }
  83  
  84  $thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' );
  85  if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) {
  86      if ( wp_attachment_is( 'audio', $post ) ) {
  87          $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' );
  88      } elseif ( wp_attachment_is( 'video', $post ) ) {
  89          $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' );
  90      }
  91  }
  92  
  93  if ( $thumbnail_support ) {
  94      add_thickbox();
  95      wp_enqueue_media( array( 'post' => $post_ID ) );
  96  }
  97  
  98  // Add the local autosave notice HTML
  99  add_action( 'admin_footer', '_local_storage_notice' );
 100  
 101  /*
 102   * @todo Document the $messages array(s).
 103   */
 104  $permalink = get_permalink( $post_ID );
 105  if ( ! $permalink ) {
 106      $permalink = '';
 107  }
 108  
 109  $messages = array();
 110  
 111  $preview_post_link_html   = '';
 112  $scheduled_post_link_html = '';
 113  $view_post_link_html      = '';
 114  
 115  $preview_page_link_html   = '';
 116  $scheduled_page_link_html = '';
 117  $view_page_link_html      = '';
 118  
 119  $preview_url = get_preview_post_link( $post );
 120  
 121  $viewable = is_post_type_viewable( $post_type_object );
 122  
 123  if ( $viewable ) {
 124  
 125      // Preview post link.
 126      $preview_post_link_html = sprintf(
 127          ' <a target="_blank" href="%1$s">%2$s</a>',
 128          esc_url( $preview_url ),
 129          __( 'Preview post' )
 130      );
 131  
 132      // Scheduled post preview link.
 133      $scheduled_post_link_html = sprintf(
 134          ' <a target="_blank" href="%1$s">%2$s</a>',
 135          esc_url( $permalink ),
 136          __( 'Preview post' )
 137      );
 138  
 139      // View post link.
 140      $view_post_link_html = sprintf(
 141          ' <a href="%1$s">%2$s</a>',
 142          esc_url( $permalink ),
 143          __( 'View post' )
 144      );
 145  
 146      // Preview page link.
 147      $preview_page_link_html = sprintf(
 148          ' <a target="_blank" href="%1$s">%2$s</a>',
 149          esc_url( $preview_url ),
 150          __( 'Preview page' )
 151      );
 152  
 153      // Scheduled page preview link.
 154      $scheduled_page_link_html = sprintf(
 155          ' <a target="_blank" href="%1$s">%2$s</a>',
 156          esc_url( $permalink ),
 157          __( 'Preview page' )
 158      );
 159  
 160      // View page link.
 161      $view_page_link_html = sprintf(
 162          ' <a href="%1$s">%2$s</a>',
 163          esc_url( $permalink ),
 164          __( 'View page' )
 165      );
 166  
 167  }
 168  
 169  $scheduled_date = sprintf(
 170      /* translators: Publish box date string. 1: Date, 2: Time. */
 171      __( '%1$s at %2$s' ),
 172      /* translators: Publish box date format, see https://secure.php.net/date */
 173      date_i18n( _x( 'M j, Y', 'publish box date format' ), strtotime( $post->post_date ) ),
 174      /* translators: Publish box time format, see https://secure.php.net/date */
 175      date_i18n( _x( 'H:i', 'publish box time format' ), strtotime( $post->post_date ) )
 176  );
 177  
 178  $messages['post']       = array(
 179      0  => '', // Unused. Messages start at index 1.
 180      1  => __( 'Post updated.' ) . $view_post_link_html,
 181      2  => __( 'Custom field updated.' ),
 182      3  => __( 'Custom field deleted.' ),
 183      4  => __( 'Post updated.' ),
 184      /* translators: %s: Date and time of the revision. */
 185      5  => isset( $_GET['revision'] ) ? sprintf( __( 'Post restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
 186      6  => __( 'Post published.' ) . $view_post_link_html,
 187      7  => __( 'Post saved.' ),
 188      8  => __( 'Post submitted.' ) . $preview_post_link_html,
 189      /* translators: %s: Scheduled date for the post. */
 190      9  => sprintf( __( 'Post scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html,
 191      10 => __( 'Post draft updated.' ) . $preview_post_link_html,
 192  );
 193  $messages['page']       = array(
 194      0  => '', // Unused. Messages start at index 1.
 195      1  => __( 'Page updated.' ) . $view_page_link_html,
 196      2  => __( 'Custom field updated.' ),
 197      3  => __( 'Custom field deleted.' ),
 198      4  => __( 'Page updated.' ),
 199      /* translators: %s: Date and time of the revision. */
 200      5  => isset( $_GET['revision'] ) ? sprintf( __( 'Page restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
 201      6  => __( 'Page published.' ) . $view_page_link_html,
 202      7  => __( 'Page saved.' ),
 203      8  => __( 'Page submitted.' ) . $preview_page_link_html,
 204      /* translators: %s: Scheduled date for the page. */
 205      9  => sprintf( __( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html,
 206      10 => __( 'Page draft updated.' ) . $preview_page_link_html,
 207  );
 208  $messages['attachment'] = array_fill( 1, 10, __( 'Media file updated.' ) ); // Hack, for now.
 209  
 210  /**
 211   * Filters the post updated messages.
 212   *
 213   * @since 3.0.0
 214   *
 215   * @param array[] $messages Post updated messages. For defaults see `$messages` declarations above.
 216   */
 217  $messages = apply_filters( 'post_updated_messages', $messages );
 218  
 219  $message = false;
 220  if ( isset( $_GET['message'] ) ) {
 221      $_GET['message'] = absint( $_GET['message'] );
 222      if ( isset( $messages[ $post_type ][ $_GET['message'] ] ) ) {
 223          $message = $messages[ $post_type ][ $_GET['message'] ];
 224      } elseif ( ! isset( $messages[ $post_type ] ) && isset( $messages['post'][ $_GET['message'] ] ) ) {
 225          $message = $messages['post'][ $_GET['message'] ];
 226      }
 227  }
 228  
 229  $notice     = false;
 230  $form_extra = '';
 231  if ( 'auto-draft' == $post->post_status ) {
 232      if ( 'edit' == $action ) {
 233          $post->post_title = '';
 234      }
 235      $autosave    = false;
 236      $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
 237  } else {
 238      $autosave = wp_get_post_autosave( $post_ID );
 239  }
 240  
 241  $form_action  = 'editpost';
 242  $nonce_action = 'update-post_' . $post_ID;
 243  $form_extra  .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr( $post_ID ) . "' />";
 244  
 245  // Detect if there exists an autosave newer than the post and if that autosave is different than the post
 246  if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
 247      foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) {
 248          if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
 249              $notice = sprintf(
 250                  /* translators: %s: URL to view the autosave. */
 251                  __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ),
 252                  get_edit_post_link( $autosave->ID )
 253              );
 254              break;
 255          }
 256      }
 257      // If this autosave isn't different from the current post, begone.
 258      if ( ! $notice ) {
 259          wp_delete_post_revision( $autosave->ID );
 260      }
 261      unset( $autosave_field, $_autosave_field );
 262  }
 263  
 264  $post_type_object = get_post_type_object( $post_type );
 265  
 266  // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
 267  require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
 268  
 269  register_and_do_post_meta_boxes( $post );
 270  
 271  add_screen_option(
 272      'layout_columns',
 273      array(
 274          'max'     => 2,
 275          'default' => 2,
 276      )
 277  );
 278  
 279  if ( 'post' == $post_type ) {
 280      $customize_display = '<p>' . __( '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.' ) . '</p>';
 281  
 282      get_current_screen()->add_help_tab(
 283          array(
 284              'id'      => 'customize-display',
 285              'title'   => __( 'Customizing This Display' ),
 286              'content' => $customize_display,
 287          )
 288      );
 289  
 290      $title_and_editor  = '<p>' . __( '<strong>Title</strong> &mdash; Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.' ) . '</p>';
 291      $title_and_editor .= '<p>' . __( '<strong>Post editor</strong> &mdash; Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.' ) . '</p>';
 292      $title_and_editor .= '<p>' . __( '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.' ) . '</p>';
 293      $title_and_editor .= '<p>' . __( 'The Text mode allows you to enter HTML along with your post text. Note that &lt;p&gt; and &lt;br&gt; 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 &lt;br&gt;, and two line breaks instead of paragraph tags. The line breaks are converted back to tags automatically.' ) . '</p>';
 294      $title_and_editor .= '<p>' . __( '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.' ) . '</p>';
 295      $title_and_editor .= '<p>' . __( '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.' ) . '</p>';
 296      $title_and_editor .= '<p>' . __( 'Keyboard users: When you&#8217;re working in the visual editor, you can use <kbd>Alt + F10</kbd> to access the toolbar.' ) . '</p>';
 297  
 298      get_current_screen()->add_help_tab(
 299          array(
 300              'id'      => 'title-post-editor',
 301              'title'   => __( 'Title and Post Editor' ),
 302              'content' => $title_and_editor,
 303          )
 304      );
 305  
 306      get_current_screen()->set_help_sidebar(
 307          '<p>' . sprintf(
 308              /* translators: %s: URL to Press This bookmarklet. */
 309              __( 'You can also create posts with the <a href="%s">Press This bookmarklet</a>.' ),
 310              'tools.php'
 311          ) . '</p>' .
 312              '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
 313              '<p>' . __( '<a href="https://wordpress.org/support/article/wordpress-editor/">Documentation on Writing and Editing Posts</a>' ) . '</p>' .
 314              '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
 315      );
 316  } elseif ( 'page' == $post_type ) {
 317      $about_pages = '<p>' . __( '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 &#8220;Parent&#8221; of the other, creating a group of pages.' ) . '</p>' .
 318          '<p>' . __( '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.' ) . '</p>';
 319  
 320      get_current_screen()->add_help_tab(
 321          array(
 322              'id'      => 'about-pages',
 323              'title'   => __( 'About Pages' ),
 324              'content' => $about_pages,
 325          )
 326      );
 327  
 328      get_current_screen()->set_help_sidebar(
 329          '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
 330              '<p>' . __( '<a href="https://wordpress.org/support/article/pages-add-new-screen/">Documentation on Adding New Pages</a>' ) . '</p>' .
 331              '<p>' . __( '<a href="https://wordpress.org/support/article/pages-screen/">Documentation on Editing Pages</a>' ) . '</p>' .
 332              '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
 333      );
 334  } elseif ( 'attachment' == $post_type ) {
 335      get_current_screen()->add_help_tab(
 336          array(
 337              'id'      => 'overview',
 338              'title'   => __( 'Overview' ),
 339              'content' =>
 340                  '<p>' . __( 'This screen allows you to edit fields for metadata in a file within the media library.' ) . '</p>' .
 341                  '<p>' . __( '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.' ) . '</p>' .
 342                  '<p>' . __( '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.' ) . '</p>' .
 343                  '<p>' . __( 'Remember to click Update Media to save metadata entered or changed.' ) . '</p>',
 344          )
 345      );
 346  
 347      get_current_screen()->set_help_sidebar(
 348          '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
 349          '<p>' . __( '<a href="https://wordpress.org/support/article/edit-media/">Documentation on Edit Media</a>' ) . '</p>' .
 350          '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
 351      );
 352  }
 353  
 354  if ( 'post' == $post_type || 'page' == $post_type ) {
 355      $inserting_media  = '<p>' . __( '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 &#8220;Create a new gallery&#8221; button.' ) . '</p>';
 356      $inserting_media .= '<p>' . __( '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. <a href="https://wordpress.org/support/article/embeds/">Learn more about embeds</a>.' ) . '</p>';
 357  
 358      get_current_screen()->add_help_tab(
 359          array(
 360              'id'      => 'inserting-media',
 361              'title'   => __( 'Inserting Media' ),
 362              'content' => $inserting_media,
 363          )
 364      );
 365  }
 366  
 367  if ( 'post' == $post_type ) {
 368      $publish_box  = '<p>' . __( 'Several boxes on this screen contain settings for how your content will be published, including:' ) . '</p>';
 369      $publish_box .= '<ul><li>' .
 370          __( '<strong>Publish</strong> &mdash; You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). The Password protected option allows you to set an arbitrary password for each post. The Private option hides the post from everyone except editors and administrators. Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.' ) .
 371      '</li>';
 372  
 373      if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) {
 374          $publish_box .= '<li>' . __( '<strong>Format</strong> &mdash; Post Formats designate how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Your theme could enable all or some of 10 possible formats. <a href="https://wordpress.org/support/article/post-formats/#supported-formats">Learn more about each post format</a>.' ) . '</li>';
 375      }
 376  
 377      if ( current_theme_supports( 'post-thumbnails' ) && post_type_supports( 'post', 'thumbnail' ) ) {
 378          $publish_box .= '<li>' . sprintf(
 379              /* translators: %s: Featured Image. */
 380              __( '<strong>%s</strong> &mdash; This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the image as a post thumbnail on the home page, a custom header, etc.' ),
 381              esc_html( $post_type_object->labels->featured_image )
 382          ) . '</li>';
 383      }
 384  
 385      $publish_box .= '</ul>';
 386  
 387      get_current_screen()->add_help_tab(
 388          array(
 389              'id'      => 'publish-box',
 390              'title'   => __( 'Publish Settings' ),
 391              'content' => $publish_box,
 392          )
 393      );
 394  
 395      $discussion_settings  = '<p>' . __( '<strong>Send Trackbacks</strong> &mdash; Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they&#8217;ll be notified automatically using pingbacks, and this field is unnecessary.' ) . '</p>';
 396      $discussion_settings .= '<p>' . __( '<strong>Discussion</strong> &mdash; 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.' ) . '</p>';
 397  
 398      get_current_screen()->add_help_tab(
 399          array(
 400              'id'      => 'discussion-settings',
 401              'title'   => __( 'Discussion Settings' ),
 402              'content' => $discussion_settings,
 403          )
 404      );
 405  } elseif ( 'page' == $post_type ) {
 406      $page_attributes = '<p>' . __( '<strong>Parent</strong> &mdash; You can arrange your pages in hierarchies. For example, you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how many levels you can nest pages.' ) . '</p>' .
 407          '<p>' . __( '<strong>Template</strong> &mdash; Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them in this dropdown menu.' ) . '</p>' .
 408          '<p>' . __( '<strong>Order</strong> &mdash; Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.' ) . '</p>';
 409  
 410      get_current_screen()->add_help_tab(
 411          array(
 412              'id'      => 'page-attributes',
 413              'title'   => __( 'Page Attributes' ),
 414              'content' => $page_attributes,
 415          )
 416      );
 417  }
 418  
 419  require_once( ABSPATH . 'wp-admin/admin-header.php' );
 420  ?>
 421  
 422  <div class="wrap">
 423  <h1 class="wp-heading-inline">
 424  <?php
 425  echo esc_html( $title );
 426  ?>
 427  </h1>
 428  
 429  <?php
 430  if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) {
 431      echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
 432  }
 433  ?>
 434  
 435  <hr class="wp-header-end">
 436  
 437  <?php if ( $notice ) : ?>
 438  <div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice; ?></p></div>
 439  <?php endif; ?>
 440  <?php if ( $message ) : ?>
 441  <div id="message" class="updated notice notice-success is-dismissible"><p><?php echo $message; ?></p></div>
 442  <?php endif; ?>
 443  <div id="lost-connection-notice" class="error hidden">
 444      <p><span class="spinner"></span> <?php _e( '<strong>Connection lost.</strong> Saving has been disabled until you&#8217;re reconnected.' ); ?>
 445      <span class="hide-if-no-sessionstorage"><?php _e( 'We&#8217;re backing up this post in your browser, just in case.' ); ?></span>
 446      </p>
 447  </div>
 448  <form name="post" action="post.php" method="post" id="post"
 449  <?php
 450  /**
 451   * Fires inside the post editor form tag.
 452   *
 453   * @since 3.0.0
 454   *
 455   * @param WP_Post $post Post object.
 456   */
 457  do_action( 'post_edit_form_tag', $post );
 458  
 459  $referer = wp_get_referer();
 460  ?>
 461  >
 462  <?php wp_nonce_field( $nonce_action ); ?>
 463  <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID; ?>" />
 464  <input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ); ?>" />
 465  <input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ); ?>" />
 466  <input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
 467  <input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />
 468  <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status ); ?>" />
 469  <input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" />
 470  <?php if ( ! empty( $active_post_lock ) ) { ?>
 471  <input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" />
 472      <?php
 473  }
 474  if ( 'draft' != get_post_status( $post ) ) {
 475      wp_original_referer_field( true, 'previous' );
 476  }
 477  
 478  echo $form_extra;
 479  
 480  wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
 481  wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
 482  ?>
 483  
 484  <?php
 485  /**
 486   * Fires at the beginning of the edit form.
 487   *
 488   * At this point, the required hidden fields and nonces have already been output.
 489   *
 490   * @since 3.7.0
 491   *
 492   * @param WP_Post $post Post object.
 493   */
 494  do_action( 'edit_form_top', $post );
 495  ?>
 496  
 497  <div id="poststuff">
 498  <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
 499  <div id="post-body-content">
 500  
 501  <?php if ( post_type_supports( $post_type, 'title' ) ) { ?>
 502  <div id="titlediv">
 503  <div id="titlewrap">
 504      <?php
 505      /**
 506       * Filters the title field placeholder text.
 507       *
 508       * @since 3.1.0
 509       *
 510       * @param string  $text Placeholder text. Default 'Add title'.
 511       * @param WP_Post $post Post object.
 512       */
 513      $title_placeholder = apply_filters( 'enter_title_here', __( 'Add title' ), $post );
 514      ?>
 515      <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $title_placeholder; ?></label>
 516      <input type="text" name="post_title" size="30" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" spellcheck="true" autocomplete="off" />
 517  </div>
 518      <?php
 519      /**
 520       * Fires before the permalink field in the edit form.
 521       *
 522       * @since 4.1.0
 523       *
 524       * @param WP_Post $post Post object.
 525       */
 526      do_action( 'edit_form_before_permalink', $post );
 527      ?>
 528  <div class="inside">
 529      <?php
 530      if ( $viewable ) :
 531          $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html( $post->ID ) : '';
 532  
 533          // As of 4.4, the Get Shortlink button is hidden by default.
 534          if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) {
 535              $shortlink = wp_get_shortlink( $post->ID, 'post' );
 536  
 537              if ( ! empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url( '?page_id=' . $post->ID ) ) {
 538                  $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" /><button type="button" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val());">' . __( 'Get Shortlink' ) . '</button>';
 539              }
 540          }
 541  
 542          if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) {
 543              $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;
 544              ?>
 545      <div id="edit-slug-box" class="hide-if-no-js">
 546              <?php
 547              if ( $has_sample_permalink ) {
 548                  echo $sample_permalink_html;
 549              }
 550              ?>
 551      </div>
 552              <?php
 553          }
 554  endif;
 555      ?>
 556  </div>
 557      <?php
 558      wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
 559      ?>
 560  </div><!-- /titlediv -->
 561      <?php
 562  }
 563  /**
 564   * Fires after the title field.
 565   *
 566   * @since 3.5.0
 567   *
 568   * @param WP_Post $post Post object.
 569   */
 570  do_action( 'edit_form_after_title', $post );
 571  
 572  if ( post_type_supports( $post_type, 'editor' ) ) {
 573      $_wp_editor_expand_class = '';
 574      if ( $_wp_editor_expand ) {
 575          $_wp_editor_expand_class = ' wp-editor-expand';
 576      }
 577      ?>
 578  <div id="postdivrich" class="postarea<?php echo $_wp_editor_expand_class; ?>">
 579  
 580      <?php
 581      wp_editor(
 582          $post->post_content,
 583          'content',
 584          array(
 585              '_content_editor_dfw' => $_content_editor_dfw,
 586              'drag_drop_upload'    => true,
 587              'tabfocus_elements'   => 'content-html,save-post',
 588              'editor_height'       => 300,
 589              'tinymce'             => array(
 590                  'resize'                  => false,
 591                  'wp_autoresize_on'        => $_wp_editor_expand,
 592                  'add_unload_trigger'      => false,
 593                  'wp_keep_scroll_position' => ! $is_IE,
 594              ),
 595          )
 596      );
 597      ?>
 598  <table id="post-status-info"><tbody><tr>
 599      <td id="wp-word-count" class="hide-if-no-js">
 600      <?php
 601      printf(
 602          /* translators: %s: Number of words. */
 603          __( 'Word count: %s' ),
 604          '<span class="word-count">0</span>'
 605      );
 606      ?>
 607      </td>
 608      <td class="autosave-info">
 609      <span class="autosave-message">&nbsp;</span>
 610      <?php
 611      if ( 'auto-draft' != $post->post_status ) {
 612          echo '<span id="last-edit">';
 613          $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) );
 614          if ( $last_user ) {
 615              /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time. */
 616              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 ) );
 617          } else {
 618              /* translators: 1: Post edited date, 2: Post edited time. */
 619              printf( __( 'Last edited on %1$s at %2$s' ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) );
 620          }
 621          echo '</span>';
 622      }
 623      ?>
 624      </td>
 625      <td id="content-resize-handle" class="hide-if-no-js"><br /></td>
 626  </tr></tbody></table>
 627  
 628  </div>
 629      <?php
 630  }
 631  /**
 632   * Fires after the content editor.
 633   *
 634   * @since 3.5.0
 635   *
 636   * @param WP_Post $post Post object.
 637   */
 638  do_action( 'edit_form_after_editor', $post );
 639  ?>
 640  </div><!-- /post-body-content -->
 641  
 642  <div id="postbox-container-1" class="postbox-container">
 643  <?php
 644  
 645  if ( 'page' == $post_type ) {
 646      /**
 647       * Fires before meta boxes with 'side' context are output for the 'page' post type.
 648       *
 649       * The submitpage box is a meta box with 'side' context, so this hook fires just before it is output.
 650       *
 651       * @since 2.5.0
 652       *
 653       * @param WP_Post $post Post object.
 654       */
 655      do_action( 'submitpage_box', $post );
 656  } else {
 657      /**
 658       * Fires before meta boxes with 'side' context are output for all post types other than 'page'.
 659       *
 660       * The submitpost box is a meta box with 'side' context, so this hook fires just before it is output.
 661       *
 662       * @since 2.5.0
 663       *
 664       * @param WP_Post $post Post object.
 665       */
 666      do_action( 'submitpost_box', $post );
 667  }
 668  
 669  
 670  do_meta_boxes( $post_type, 'side', $post );
 671  
 672  ?>
 673  </div>
 674  <div id="postbox-container-2" class="postbox-container">
 675  <?php
 676  
 677  do_meta_boxes( null, 'normal', $post );
 678  
 679  if ( 'page' == $post_type ) {
 680      /**
 681       * Fires after 'normal' context meta boxes have been output for the 'page' post type.
 682       *
 683       * @since 1.5.0
 684       *
 685       * @param WP_Post $post Post object.
 686       */
 687      do_action( 'edit_page_form', $post );
 688  } else {
 689      /**
 690       * Fires after 'normal' context meta boxes have been output for all post types other than 'page'.
 691       *
 692       * @since 1.5.0
 693       *
 694       * @param WP_Post $post Post object.
 695       */
 696      do_action( 'edit_form_advanced', $post );
 697  }
 698  
 699  
 700  do_meta_boxes( null, 'advanced', $post );
 701  
 702  ?>
 703  </div>
 704  <?php
 705  /**
 706   * Fires after all meta box sections have been output, before the closing #post-body div.
 707   *
 708   * @since 2.1.0
 709   *
 710   * @param WP_Post $post Post object.
 711   */
 712  do_action( 'dbx_post_sidebar', $post );
 713  
 714  ?>
 715  </div><!-- /post-body -->
 716  <br class="clear" />
 717  </div><!-- /poststuff -->
 718  </form>
 719  </div>
 720  
 721  <?php
 722  if ( post_type_supports( $post_type, 'comments' ) ) {
 723      wp_comment_reply();
 724  }
 725  ?>
 726  
 727  <?php if ( ! wp_is_mobile() && post_type_supports( $post_type, 'title' ) && '' === $post->post_title ) : ?>
 728  <script type="text/javascript">
 729  try{document.post.title.focus();}catch(e){}
 730  </script>
 731  <?php endif; ?>


Generated: Thu Sep 19 01:00:03 2019 Cross-referenced by PHPXref 0.7.1