Quantcast
Channel: User Michael - WordPress Development Stack Exchange
Viewing all articles
Browse latest Browse all 44

Answer by Michael for Can I show all the template files that are being used on my site?

$
0
0

this would add a column with the page template file name into the 'Pages' in the dashboard:

// ONLY WORDPRESS DEFAULT PAGESadd_filter('manage_page_posts_columns', 'custom_admin_columns_head', 10);add_action('manage_page_posts_custom_column', 'custom_admin_columns_content', 10, 2);// ADD NEW COLUMNfunction custom_admin_columns_head($defaults) {    $defaults['page_template_file'] = 'Page Template File';    return $defaults;}// SHOW THE PAGE TEMPLATE FILE NAMEfunction custom_admin_columns_content($column_name, $post_ID) {    if ($column_name == 'page_template_file') {        $page_template_file = get_post_meta( $post_ID, '_wp_page_template', true );            echo ($page_template_file ? $page_template_file : '-');    }}

based on:https://codex.wordpress.org/Function_Reference/get_page_template_slughttps://code.tutsplus.com/articles/add-a-custom-column-in-posts-and-custom-post-types-admin-screen--wp-24934


Viewing all articles
Browse latest Browse all 44

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>