diff --git a/src/wp-admin/edit-form-advanced.php b/src/wp-admin/edit-form-advanced.php
index 540f1edab2..73cb63b8e3 100644
--- a/src/wp-admin/edit-form-advanced.php
+++ b/src/wp-admin/edit-form-advanced.php
@@ -259,8 +259,9 @@ foreach ( get_object_taxonomies( $post ) as $tax_name ) {
add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) );
}
-if ( post_type_supports($post_type, 'page-attributes') )
- add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core');
+if ( post_type_supports( $post_type, 'page-attributes' ) || count( get_page_templates( null, $post_type ) ) > 0 ) {
+ add_meta_box( 'pageparentdiv', $post_type_object->labels->attributes, 'page_attributes_meta_box', null, 'side', 'core' );
+}
if ( $thumbnail_support && current_user_can( 'upload_files' ) )
add_meta_box('postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low');
diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php
index 714a491d2e..d26ab2f11b 100644
--- a/src/wp-admin/includes/class-wp-posts-list-table.php
+++ b/src/wp-admin/includes/class-wp-posts-list-table.php
@@ -1528,31 +1528,28 @@ class WP_Posts_List_Table extends WP_List_Table {
- post_type ) :
- ?>
-
-
-
+ post_type ) ) ) : ?>
+
+
+
diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php
index 48c5e37a53..13d463d2c9 100644
--- a/src/wp-admin/includes/meta-boxes.php
+++ b/src/wp-admin/includes/meta-boxes.php
@@ -788,8 +788,7 @@ function post_revisions_meta_box( $post ) {
* @param object $post
*/
function page_attributes_meta_box($post) {
- $post_type_object = get_post_type_object($post->post_type);
- if ( $post_type_object->hierarchical ) {
+ if ( is_post_type_hierarchical( $post->post_type ) ) :
$dropdown_args = array(
'post_type' => $post->post_type,
'exclude_tree' => $post->ID,
@@ -812,16 +811,17 @@ function page_attributes_meta_box($post) {
*/
$dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post );
$pages = wp_dropdown_pages( $dropdown_args );
- if ( ! empty($pages) ) {
+ if ( ! empty($pages) ) :
?>
post_type && 0 != count( get_page_templates( $post ) ) && get_option( 'page_for_posts' ) != $post->ID ) {
- $template = !empty($post->page_template) ? $post->page_template : false;
+ endif; // end empty pages check
+ endif; // end hierarchical check.
+
+ if ( count( get_page_templates( $post ) ) > 0 && get_option( 'page_for_posts' ) != $post->ID ) :
+ $template = ! empty( $post->page_template ) ? $post->page_template : false;
?>
-