• Resolved mattspace

    (@mattspace)


    Hi,

    Just wondering if what I want to do is easily doable, or what the best way to achieve the result is.

    I have two different wordpress installs, I want to use a single parent theme for both of them (so I can just update that one instance), and then child themes to customise each – one’s child will be using functions.php to remove certain post categories from the home page and rss feed, the other’s will be to change CSS properties.

    All the tutorials I’ve read assume parent and child themes are in the same wp-content/themes directory as the parent. Is there a correct syntax for the child theme to route an absolute or relative URL to a parent in a different directory?

    Can you do something like:

    • /public_html/site_one/wp-content/themes/parent_theme
    • /public_html/site_one/wp-content/themes/child_theme
    • /public_html/site_two/wp-content/themes/child_theme

    Is it just a case of making the Template: value in the child CSS:

    Template: ../../../../site_one/wp-content/themes/parent_theme

    Or, would it need to be an absolute URL:

    Template: https://www.theWebSite.com/site_one/wp-content/themes/parent_theme

    Failing that, can you symlink the parent theme’s directory from the first site to the second?

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Yui

    (@fierevere)

    永子

    As local paths are not acessible remotely, you have to try with URL’s when something has to be loaded by visitor’s browser (however PHP files are executed by server’s local PHP interpreter), that complicate the things.

    However, if your webserver permits following symlinks, you can create a symbolic link to theme directory,

    it will work as you have a copy of the folder under the symlinked location

    Thread Starter mattspace

    (@mattspace)

    Right, so conceptually I should think of things as if the parent and child themes are hardcoded to require being in the same directory, and speak to my webhost about whether I can symlink from the first site’s /themes directory, to the second?

    So I’d have:

    • /public_html/site_one/wp-content/themes/parent_theme
    • /public_html/site_two/wp-content/themes/parent_theme(symlink)
    • /public_html/site_two/wp-content/themes/child_theme

    Is that the easiest / best way to go about it?

    Thanks.

    Moderator Yui

    (@fierevere)

    永子

    Yes, you just have to do it from command line prompt on server (ssh or console at hosting control panel)

    or some FTP clients also support creating symlinking (check their folder/file operation menu)

    If using command prompt, syntax is ln -s <source> <target>
    which can be relative paths as well, or you can ask hosting support to assist you

    Thread Starter mattspace

    (@mattspace)

    much appreciated 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Remote parent theme (absolute or relative paths)?’ is closed to new replies.