mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Posts, Post Types: Add support for post type templates.
WordPress has supported custom page templates for over 12 years, allowing developers to create various layouts for specific pages. While this feature is very helpful, it has always been limited to the 'page' post type and not was not available to other post types. By opening up the page template functionality to all post types, we continue to improve the template hierarchy's flexibility. In addition to the `Template Name` file header, the post types supported by a template can be specified using `Template Post Type: post, foo, bar`. When at least one template exists for a post type, the 'Post Attributes' meta box will be displayed in the back end, without the need to add post type support for `'page-attributes'`. 'Post Attributes' can be customized per post type using the `'attributes'` label when registering a post type. Props johnbillion, Mte90, dipesh.kakadiya, swissspidy. Fixes #18375. git-svn-id: https://develop.svn.wordpress.org/trunk@38951 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1528,31 +1528,28 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
<span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>
|
||||
</label>
|
||||
|
||||
<?php endif; // !$bulk
|
||||
|
||||
if ( 'page' === $screen->post_type ) :
|
||||
?>
|
||||
|
||||
<label>
|
||||
<span class="title"><?php _e( 'Template' ); ?></span>
|
||||
<select name="page_template">
|
||||
<?php if ( $bulk ) : ?>
|
||||
<option value="-1"><?php _e( '— No Change —' ); ?></option>
|
||||
<?php endif; // $bulk ?>
|
||||
<?php
|
||||
/** This filter is documented in wp-admin/includes/meta-boxes.php */
|
||||
$default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'quick-edit' );
|
||||
?>
|
||||
<option value="default"><?php echo esc_html( $default_title ); ?></option>
|
||||
<?php page_template_dropdown() ?>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<?php
|
||||
endif; // page post_type
|
||||
endif; // !$bulk
|
||||
endif; // page-attributes
|
||||
?>
|
||||
|
||||
<?php if ( 0 < count( get_page_templates( null, $screen->post_type ) ) ) : ?>
|
||||
<label>
|
||||
<span class="title"><?php _e( 'Template' ); ?></span>
|
||||
<select name="page_template">
|
||||
<?php if ( $bulk ) : ?>
|
||||
<option value="-1"><?php _e( '— No Change —' ); ?></option>
|
||||
<?php endif; // $bulk ?>
|
||||
<?php
|
||||
/** This filter is documented in wp-admin/includes/meta-boxes.php */
|
||||
$default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'quick-edit' );
|
||||
?>
|
||||
<option value="default"><?php echo esc_html( $default_title ); ?></option>
|
||||
<?php page_template_dropdown( $post->page_template, $screen->post_type ) ?>
|
||||
</select>
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( count( $flat_taxonomies ) && !$bulk ) : ?>
|
||||
|
||||
<?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
|
||||
|
||||
Reference in New Issue
Block a user