• Hello guys!

    Maybe you will be nerveous me, but i should say, i really don’t like how wordpress use the database tables. But this is another case.

    Ok, my problem is:
    I have a domain A called xxxxxx.com, and a domain B, called zzzzzzz.com.

    The storage is on the same server, and for both domains, the doument root is the same.

    I want to write a plugin, what is change the theme based on the domain name. No problem till here, becuse i can use the switch_theme function.

    My problem is, i dont’t know, what is the theme dir, what is did set in the wordpress admin.

    get_current_theme() is not a solution, because a user go to zzzzzz.com, i switch the theme, but after that, the current theme will be switched.

    Ok, i can hack it with a session variable, if the user run the site first, a i store it into a session variable, and if this session variable is seted, i do not set again, but what if, another plugin did changed the theme before my plugin runs?

    So obviusly the solution is to read out from the database.
    so let’s: select * from wp_options where option_name like ‘%theme%’

    And yes! There are the row with option_name: current_theme.

    and…. errrr….. oh nooooooo :(((
    the value of it: Twenty Eleven

    What the hack? how can i tell to switch_theme to use Twenty Eleven theme, while there are no Twenty Eleven theme, in the themes directory, this is just the name of it.

    Why is it a big problem to use normal form 3 or 4 in wordpress?

    I dont care, let’s say, serialized values are good, no need to modify table definitions if we need a new field or something, like mongodb.

    But for name of the jesus, why don’t you just make a new row like option_name: ‘installed_themes’
    and give theme an id, and then stored this ID too…

    What is the algorythm, how i can get the theme, what is did set in WP???

  • The topic ‘Get theme name from db’ is closed to new replies.