2

I have come across a wonderful portfolio website https://dogstudio.co/ while I was looking for examples of design. Upon exploring the source-code, it was apparent that this was a wordpress website after all.

What I don't understand is how and why does it not have the typical wordpress directory hierarchy. For example, this is the URL to their CSS file, https://dogstudio.co/app/themes/portfolio-2018/static/css/main.css.

A typical wordpress website would have something like this, https://www.example.com/wp-content/themes/theme_name/style.css (the wp-content and wp- prefixed directories) as a general rule of thumb for making wordpress themes.

So was it made using a framework? I really need to understand this.

1

2 Answers 2

3

That site probably uses the Roots Bedrock framework, which moves the theme/plugin folders around into an app subfolder. This is mainly due to the preference of that framework though, rather than for any structural benefit.

It's also possible they use standard WordPress but have renamed wp-content using constants in wp-config.php , e.g.

define('WP_CONTENT_URL', 'https://example.com/app');
define('WP_CONTENT_DIR', '/var/www/example.com/public_html/app/');

Why Change the wp-content directory location?

If you want to use a git submodule to install WordPress, or a package manager such as composer, having WordPress in a subfolder on its own makes it easier to update and install.

This necessitates moving wp-content out of that folder though to avoid nested folders. E.g composer updates packages by deleting them and installing the new version, which would destroy all uploaded files, plugins, and themes.

So instead, you might have a folder structure like this:

 - wordpress ( sometimes wp )
 - wp-content
   - themes
   - plugins
   - etc..
 - wp-config.php
 - index.php

Such a setup requires more steps to set up than a normal WordPress install however, and isn't well suited for most use cases and hosts. If you're using the auto-updater to keep WordPress up to date and don't use a site-wide version control, or use WP CLI to update WordPress, then you won't see many benefits by moving to this setup.

As for why Bedrock does it that way, the answer is simple, the maintainers prefer those folder names and organisation. Other than that Bedrock provides a local environment, but not much else. It's a boilerplate for setting up WordPress. For more info or if you have questions about Bedrock, you should visit https://roots.io/bedrock/ and ask in their community

3
  • and this has nothing to do with performance or page load times or any of the "necessary" metrics? I can still have the page transitions and everything else just as smooth and fast using the "normal" WP way, right? Nov 27, 2020 at 6:02
  • 1
    Indeed, it has no impact on performance or metrics, or the way you build your site. TLDR the bedrock people prefer this folder layout, it's purely a personal preference not a technical advantage. Everything works the same way. Some very poorly built plugins that hardcode wp-content might break though, but that's due to poor coding
    – Tom J Nowell
    Nov 27, 2020 at 10:46
  • 1
    Generally, WP "frameworks" focus on enabling people to do things that might be beyond their current skills, or save development time. There isn't a lot of room to impact performance etc, since the parts that determine the performance of the site are the parts determined by you. Any framework can be used to make an awfully performing site if you decide you want to make a HTTP request on every page load, or fetch 1000 posts per page, or any of the others, so don't pursue frameworks in hopes of performance gains
    – Tom J Nowell
    Nov 27, 2020 at 10:53
0

You can store WordPress static assets anywhere, even on a CDN completely separate from the server hosting your website. Most likely what they're doing here are utilizing server rewrites that point /app/themes -> /wp-content/themes.

It's also possible to change the location of the wp-content/themes path completely using the register_theme_directory(ABSPATH . 'app/themes') function.

If you're asking why they did this, it could be as simple as code aesthetics or as complex as a customized multisite installation with once centralized WordPress codebase.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.