Sage WordPress Starter Theme

repository·main·Indexed 12 days ago

https://github.com/roots/sage

A professional WordPress starter theme that integrates modern web engineering tools including Laravel Blade for component-based templating, Tailwind CSS for styling, and Vite for front-end tooling. It features Acorn integration to leverage Laravel's feature set and provides built-in support for the WordPress Block Editor.

Tokens
450
Snippets
2
Records
3
Agent score
46%

What's inside Sage

  1. Overview of Sage

    main

    Sage is an advanced hybrid WordPress starter theme designed to bring modern development workflows to WordPress. It integrates Laravel Blade for clean, component-based PHP templating and uses Vite for a fast front-end development experience, including instant builds and CSS hot-reloading.

    Key features include:

    • Laravel Blade: Organized, component-based templating.
    • Vite: Modern JavaScript and CSS tooling.
    • Tailwind CSS: Out-of-the-box support for utility-first styling.
    • Acorn Integration: Allows you to leverage Laravel's robust feature set within WordPress.
    • Block Editor Support: Built-in support for the WordPress Block Editor.
  2. Initialize the Sage theme entrypoint

    main

    The index.php file serves as the primary entrypoint for the Sage theme. It uses the application container to resolve the sage.view and sage.data services, passing the data to the view to render the theme's main output. This pattern indicates that Sage is built on a service container architecture where the view engine and data providers are decoupled and managed by the app() helper.

    <?php
    
    echo view(app('sage.view'), app('sage.data'))->render();
  3. Use the App view composer to inject global data

    main

    The App amespace\ View\Composers\App class is a global view composer that extends Roots\Acorn\View\Composer. It is configured to serve all theme templates via the protected static $views = ['*']; property.

    Any public method defined in this class becomes available as a variable in your Blade templates. For example, the siteName() method allows you to access the site's display name directly in any view.

    // In your Blade template (e.g., layout.blade.php)
    <h1>{{ $siteName }}</h1>