TransWikia.com

Understanding Wordpress(framework?) Web Development

WordPress Development Asked by Anuj Kaithwas on December 10, 2020

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.

2 Answers

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

Correct answer by Tom J Nowell on December 10, 2020

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.

Answered by Brian Burton on December 10, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP