When developing themes or plugins yourself, it's important that you understand how Evolution handles the core wordpress code.
Traditionally in a wordpress site, your code would be mixed in with wordpress' core files, and any time you upgrade wordpress, you'd see a flood of file changes and deletions...all of which need to be committed to version control.
Evolution takes a different approach, and isolates the wordpress core files into the web/wp/ directory. Because these files are (1) dynamically pulled in with bower and (2) ignored by git, the core files are never versioned and should never have to be modified by you.
Sidenote: This means that, if you upgrade Wordpress through the built-in dashboard, you should either (a) regenerate your site or (b) manually update the wordpress version in your
bower.jsonfile.Failing to do this could cause a subsequent deployment to accidentally downgrade your current wordpress installation.
Any themes, plugins, and uploaded content are stored separately in web/wp-content:
. <- project root
└── web
├── wp <- wordpress core files, managed by bower and git-ignored
└── wp-content
├── plugins <- plugins get installed here
├── themes <- themes get installed here
└── uploads <- uploaded content gets saved here
Now, what does all of this mean for developing your own themes and plugins?
When you work directly with the filesystem, or include php files, be aware of the separate directories noted above, and use path constants as often as possible:
ABSPATH- This is the filesystem path to the (git-ignored and bower-managed) core wordpress files.WP_CONTENT_DIR- This is the filesystem path to installed themes/plugins, and stored upload content. In most cases, this is the one to use in your theme and plugin code.
Most other constants defined by the core wordpress code (WP_PLUGIN_DIR, for example) are built on top of WP_CONTENT_DIR.
The difference between home and site URLs is thoroughly explained here, but the short version goes like this:
- The home url is where you want visitors to reach your blog.
- The site url is literally where your wordpress core files are installed.
It may not seem like it, but this is a very important distinction.
From within your themes and plugins, you should always use the WP_HOME constant or home_url() API function when linking to the user-facing site.