Skip to content

WP Packages is our new WPackagist replacement that's 17x faster and updates every 5 minutes

Sage
  • Sage page

Roots is an independent open source org, supported only by developers like you. We’ve been improving the WordPress developer experience since 2011, and your support keeps it independent.

Adding Theme Functionality in Sage

View as Markdown:

The app/ directory contains all the theme functionality. Since Sage is a starter theme, it’s okay for you to modify files within app/ to meet the needs of the site you’re building.

Most of the PHP code in Sage is namespaced and autoloaded, so make sure to use namespaced functions and classes. If you aren't familiar with these methods, see our blog posts on:

The app/ directory

  • app/setup.php — Enqueue stylesheets and scripts, register support for theme features with add_theme_support, register navigation menus and sidebars. See Theme Configuration and Setup.

  • app/filters.php — Add WordPress filters in this file. Filters included by default:

    • excerpt_more — add "… Continued" to excerpts.
  • app/Providers — The place for any Service Providers you care to define for your theme. Comes with ThemeServiceProvider that adds no functionality but provides a template for your own Service Providers.

  • app/View — The place for view-related code, i.e. Composers and Components. For more information, see the documentation on Composers and Components.

Last updated