更新时间:
WordPress 4.4中的页面模板使用信息array_intersect_assoc() 已从中删除WP_Theme::get_page_templates() 方法
参见票证#13265 和变更集#34995.
因此,我们可以使用theme_page_templates 过滤器,无需使用javascript或一些巧妙的对象缓存技巧here by @MikeSchinkel 或here by @gmazzap. 
下面是一个演示(PHP 5.4+):
add_filter( \'theme_page_templates\', function( $page_templates, $obj, $post )
{
    // Restrict to the post.php loading
    if( ! did_action( \'load-post.php\' ) )
        return $page_templates;
    foreach( (array) $page_templates as $key => $template )
    {
        $posts = get_posts( 
            [
                \'post_type\'      => \'any\',
                \'post_status\'    => \'any\', 
                \'posts_per_page\' => 10,
                \'fields\'         => \'ids\',
                \'meta_query\'     => [
                    [
                        \'key\'       => \'_wp_page_template\',
                        \'value\'     => $key,
                        \'compare\'   => \'=\',
                    ]
                ]
            ]
        );
        $count = count( $posts );
        // Add the count to the template name in the dropdown. Use 10+ for >= 10
        $page_templates[$key] = sprintf( 
            \'%s (%s)\', 
            $template, 
             $count >= 10 ? \'10+\' : $count
        );          
    }
    return $page_templates;
}, 10, 3 );
Example:
在这里,我们可以看到它的样子,使用计数信息添加到模板名称中:

希望您可以根据自己的需要进行调整!