[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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


Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref