Viewing 3 replies - 1 through 3 (of 3 total)
  • but the problem is when I active that template on my sub-websites, CSS/JS can’t load!
    I get the URL like that: https://example.com/my-sub-site/wp-content/themes/x/style.css which does not exist because I installed that template at https://example.com/
    so the real URL of the style should be:
    https://example.com/my-sub-site/wp-content/themes/x/style.css

    This shouoldn’t be a problem if this “template” (I’m supposing this is a WordPress theme) was built correctly.

    But it sounds like you hard-coded links to the CSS/JS files, hence the problem you’re facing.

    Please take a look at the resource below to propaly link your themne’s assets, so the URLs will work irrespective of what sub-site you’re on.

    (If I misunderstood your question, please let me know ?? )

    https://developer.www.ads-software.com/themes/basics/linking-theme-files-directories/

    Thread Starter m-esmaili

    (@m-esmaili)

    Hi @gappiah and thanks for your reply.
    actually, it’s not just about the theme and I have the same issue with plugins.
    and I have checked the linking of the theme and everything looks good.

    Using a common theme or plugin for multiple sites in a WordPress Multisite network is a very basic, built-in feature… and assets should load correctly with the correct URLs (which includes the subsite in the path) without any tweaks.

    If this is not working for you, the problem is elsewhere, and not what you’re supposing it to be. The two possible culprits I can think of are improper loading of assets and server rewrite problems.

    You may create a sandbox site with a single click here to test this (be sure to check the “Set up as Multisite” check box): https://wpsandbox.net/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘load template assets in multisite’ is closed to new replies.