WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Two Themes (5 posts)

  1. paulslocum
    Member
    Posted 5 years ago #

    I'm trying to figure out a way to display different themes depending on which URL you go to. Like you go to index.php and get the original theme, or you go to index2.php and you get an alternate theme. I'm willing to modify WordPress if necessary, I've already made quite a few modifications.

  2. moshu
    Member
    Posted 5 years ago #

    or you go to index2.php

    There is no index2.php and WP will never work with a filename like that - so forget it.

    You use ONE theme in one WP installation.
    You van, however, install some theme-switcher plugin, that lets you (and visitors) select from the installed themes.

  3. paulslocum
    Member
    Posted 5 years ago #

    it works just fine on my site:
    http://www.spiritsurfers.net/index2.php

    What I envision is that index2 sets a variable or something that overrides the current theme selection. Obviously I'd have to modify some wordpress code to make this happen.

    I'll look into the theme switcher since it'll probably give me a clue as to which code I need to change.

  4. taffeljohan
    Member
    Posted 5 years ago #

    Look at wp-includes/theme.php.

    It looks as if you could use the stylesheet and template filters to set the theme, just by modifying the values sent through to point to the theme directory you want. Everything else builds on those two.

    Or you could define TEMPLATEPATH and STYLESHEETPATH (see wp-settings.php) to what you want. This will mean that WP tries to define already defined constants in wp-settings.php, but that wouldn't be a problem in practice. Doing it with filters is aesthetically more appealing.

  5. paulslocum
    Member
    Posted 5 years ago #

    I used the hack method, setting TEMPLATEPATH and STYLESHEETPATH in the index2.php. It works great, thanks! I thought I'd have to rewrite some code.

Topic Closed

This topic has been closed to new replies.

About this Topic