Wednesday, July 17, 2013

Find out all file names used in current page - Wordpress

Just paste this code to know what are the files used to display this page.

$included_files = get_included_files();
$stylesheet_dir = str_replace( '\\', '/', get_stylesheet_directory() );
$template_dir   = str_replace( '\\', '/', get_template_directory() );

foreach ( $included_files as $key => $path ) {

    $path   = str_replace( '\\', '/', $path );

    if ( false === strpos( $path, $stylesheet_dir ) && false === strpos( $path, $template_dir ) )
        unset( $included_files[$key] );
}

print_r('<pre>'); print_r( $included_files ); print_r('</pre>');

No comments:

Post a Comment