0

I have a page that displays differently based on what type of user I'm logged in as, and I can't figure out why. Specifically, if I'm logged in as an Admin, the page displays one way, but if I'm logged in as any other type of user that is not an admin, the page displays a different way. I have tried using a plugin called Query Monitor that lets me see what template is being used to display the page, but its information is only visible when I'm logged in as an admin. So I can't see which template file is being loaded if I'm logged in as a non-admin user. Is there some way to determine what template file is being used to display a page when one is not logged in as an admin?

1

Look at the generated source code (view source in your browser) for the page. Find the body tag and look at the classes. If your theme is doing things correctly you should see tags associated with the template. They are pretty obvious but for reference: http://codex.wordpress.org/Function_Reference/body_class

| improve this answer | |
1

I would suggest using this plugin Reveal Template https://wordpress.org/plugins/reveal-template/

Alternative: Show Current Template https://wordpress.org/plugins/show-current-template/

Or you can use this snippet (https://gist.github.com/wokamoto/4553528):

add_action('wp_footer', 'view_template_files');
if ( !function_exists( 'view_template_files' ) ):
function view_template_files() {
    if ( defined('WP_DEBUG') && WP_DEBUG ) {
        global $template;
        $template_name = basename( $template, '.php' );
        $template_dir  = basename ( dirname( $template ) );
        $style_top = ( is_admin_bar_showing() ) ? "35px" : "0px";
        echo '<code style="position: fixed; top: ' . $style_top . '; right: 10px; z-index: 9999; background-color: rgba(255, 255, 255, 0.5); padding: 10px; color: #000000; border: solid 2px #000000; ">';
        echo "テーマのディレクトリ名:" . $template_dir;
        echo " テンプレートファイル名:" . $template_name;
        echo "</code>\n";
    }
}
endif;

As you can see you have to have WP_DEBUG constant defined.

| improve this answer | |
0

You can use plugins: "Show current template" https://wordpress.org/plugins/show-current-template/ or "Debug Bar" https://wordpress.org/plugins/debug-bar/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.