Using Theme Constants

WordPress.com VIP platform specific

This document is for sites running on WordPress.com VIP.

Learn more

On WordPress.com, there are a few circumstances where services and plugins will load your theme’s functions.php even if your theme isn’t directly accessed (such as our Post-by-email service, our jobs servers, the wp-api, mobile themes, etc.)

This means constants such as TEMPLATEPATH and STYLESHEETPATH will not be defined or available, and using them in your theme will likely result in fatal errors.

So:

  • Instead of TEMPLATEPATH, use get_template_directory()
  • Instead of STYLESHEETPATH, use get_stylesheet_directory()

Using the above convenient wrapper-functions will ensure your theme works in all possible scenarios where your functions.php file (or any file included by it) attempts to access the parent or child theme directories.

Ready to get started?

Drop us a note.

No matter where you are in the planning process, we’re happy to help, and we’re actual humans here on the other side of the form. 👋 We’re here to discuss your challenges and plans, evaluate your existing resources or a potential partner, or even make some initial recommendations. And, of course, we’re here to help any time you’re in the market for some robust WordPress awesomeness.