Display page template’s name into the admin
-
Hi,
I’m looking for a (plugin-free) solution to display a custom column into the page dashboard which would show the page template name of every page created.
For now I’m only able to display the path of the template used, which is not really elegant.
/** * Display page template's name column into admin */ //Add the custom column to the post type add_filter( 'manage_pages_columns', 'sp_add_custom_column' ); function sp_add_custom_column( $columns ) { $columns['template'] = 'Template'; return $columns; } // Add the data to the custom column add_action( 'manage_pages_custom_column' , 'sp_add_custom_column_data', 10, 2 ); function sp_add_custom_column_data( $column, $post_id ) { switch ( $column ) { case 'template' : $post = get_post( $post_id ); //echo get_post_meta( $post->ID, '_wp_page_template', true ); echo get_page_template_slug( $post ); break; } }
What do you think?
Thanks by advance for your help !
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Display page template’s name into the admin’ is closed to new replies.