• Could someone explain all the different index.php files that exist in an installation of WP? I am working in Dreamweaver with WAMP. In the www folder in my site folder, the first file after the last folder (wp_includes) is the core index.php file. There is also an index.php file when you spin open the wp_content folder, right under the Themes folder(but not in it). Then when you open the themes folder there is another index.php file below the last theme folder. And of course, each theme has one. There’s also one in the Plugins folder. My site works perfectly in DW using localhost if I use the Core index.php file. If I open any other index.php file in code view in DW it says “<?php
    // Silence is golden.”
    Any index.php files in Theme folders contain code but output an error message Fatal error: Call to undefined function get_header() in C:\wamp\www\mysite\wp-content\themes\twentythirteen\index.php on line 17

    So please explain the need or purpose for these files. Thank you in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • If I open any other index.php file in code view in DW it says “<?php
    // Silence is golden.”

    Those files are there to simply prevent casual browsing of your /wp-content, /themes and /plugin directories.

    Any index.php files in Theme folders contain code but output an error message Fatal error:

    Those index files are not meant to be accessed directly on a live server, but are being passed to the browser to allow display of your active theme.

    All of them are necessary and included components of WordPress.

    Default file hierarchy for comparison: https://core.trac.www.ads-software.com/browser/branches/4.1/src

    Thread Starter aubrey114

    (@aubrey114)

    Clayton,
    Thank you for the help and the link. I knew there was an explanation, just couldn’t find it. That link is a real lifesaver.

    Thank you again

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘index.php in Themes and Core’ is closed to new replies.