• Resolved spartanv7

    (@praeix)


    Hello all.

    I’m trying to see if there’s a way to detect if a particular theme is installed and enabled from a plugin. I know that the opposite can be done (detect a plugin from a theme), but is this possible?

    I’ve already attempted to define a constant in the theme that I could check if it was defined from the plugin. However, that doesn’t work and I’m pretty sure it’s because the order of how WordPress loads (plugins before themes). So the questions I have are:

    1. Can the theme load a constant earlier in the queue?
    2. Can the plugin somehow interact with the theme beforehand to see if it’s enabled? (What could be done to see if the theme at least exists on the file system could be to see if the directory exists, but that won’t tell whether the theme is actually the current active theme…right?)
    3. Should I use the settings API and store the constant in there upon theme activation so that the plugin could read from the database?

Viewing 16 replies (of 16 total)
  • Thread Starter spartanv7

    (@praeix)

    Hmm, well I can get the option to update as it should (‘enabled’ when my theme is active and ‘disabled’ when something else is active). However, the value from the plugin isn’t correct and I think I know why. Since the plugins load before the theme, it doesn’t detect the correct value until you do a page refresh…

    So yeah, maybe this is truly impossible…

Viewing 16 replies (of 16 total)
  • The topic ‘Detect If Theme Is Enabled From A Plugin’ is closed to new replies.