Support » Themes and Templates » Disentangling Theme from Index.php

  • Resolved jskirwin


    My theme and my index.php are entangled and I’m not sure how to separate them.

    What I don’t understand is the relationship between the index.php included in the desired theme (chinared), and the index at the root of the site.

    The site is here:

    Any help is appreciated.


Viewing 10 replies - 1 through 10 (of 10 total)
  • The root one (short and sweet) just passes off to the theme.

    How about describing the problem?

    The current index.php is anything but short and sweet.
    It’s determining the layout structure of the page – based on the theme 3col which it refers to using the @import url( ) command in the header.

    It then formats the display using div tags, UL and LI tags.

    When I change the @import url link, what I get is a messy looking flat-layout of the posts.

    If I replace the index.php with the one that comes with the new theme, the site doesn’t display at all and throws an error.

    The index at the root of the site is the “short and sweet”. (you should learn to read more carefully!)

    You cannot change ‘arbitrarily’ the link to another stylesheet.
    Every theme has its own index and its own stylesheet. You cannot mix them.

    You should also read about installing themes:
    (see 3.1. Adding new themes)

    My apologies, but the existing index.php at the root of the site is very long and complicated. It is not like the shorter index.php found inside the chinared theme folder.

    Also, I read the installing themes link. According to it I should be able to change the theme within the Admin Console. Whatever I select in the console shows up as the active theme, but no changes appear to the site.

    Thanks for your help.

    If you index at the root is NOT “sweet and short” – then somebody messed up your WP install.
    What WP version do you have?

    The root index should be like this:
    /* Short and sweet */
    define('WP_USE_THEMES', true);

    Nothing else.


    I’m afraid that you also mix up CSS with template. Any theme consists of at least this index.php (in the theme’s folder) AND the CSS file. Only together they function as a theme: the index.php is the architecture (or structure, if you will), the CSS file is what decides on the look and positioning.

    The root index file should never be meddled with. If it isn’t as in Moshu’s sample, either you or someone else did so obviously not knowing what they were doing.

    A common mistake is uploading a new theme, and placing the index.php of the theme not in the theme folder, but instead in the root folder.

    Thanks for the feedback.
    I will try Moshu’s “short and sweet” index.php when I get time tonight – and update you with the results.

    I made the change (copied the example code into index.php file) and what’s interesting is that my index.php file is down to 97 bytes from over 7000 – yet nothing has changed. Under view source I notice that the code is much “cleaner”; however I still can’t change the theme under the Presentation tab.

    I’m thinking a reinstall after a backup is necessary. Any ideas to prevent that are appreciated.

    Moshu’s short and sweet did indeed fix this problem.
    You rock, Moshu.
    Yes you do.
    Go Moshu!
    Go Moshu!
    Go Moshu!

    Oh yes, moshu rocks, wait till you get to deal with his encyclopedic knowledge of plugins 😉

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Disentangling Theme from Index.php’ is closed to new replies.