WordPress.org

Forums

[resolved] Check If WordPress Theme Exists and WP_THEME_DIR? (2 posts)

  1. BandonRandon
    Member
    Posted 5 years ago #

    One thing we want to do with WPBook is allow custom theme modification that won’t be overwritten by plugin upgrades. I’ve been looking into ways to check to see if a theme exists. If it does uses it if not use the default plugin theme from the plugin directory.

    I know how to do a php check for “if file_exists” however, checking for all theme files seems a bit silly. What I’m wondering is if there is a way to check if the theme exists with at least a folder and index.php file.

    Another thing I’ve been wondering, there is a WP_PLUGIN_DIR function but not WP_THEME_DIR function is there a workaround for this?

    Any help on this issue would be great!

  2. Mark / t31os
    Moderator
    Posted 5 years ago #

    So get the content directory path, and tag themes onto the end, you then have the theme directory..
    http://codex.wordpress.org/Determining_Plugin_and_Content_Directories

    Assuming you're asking for a constant you can use... :)

Topic Closed

This topic has been closed to new replies.

About this Topic