tomorrow/wp-bootstrap

A WordPress bootstrap for Tomorrow Studio projects using Timber/Twig

v1.0.21 2025-03-21 03:15 UTC

README

This Composer package extends the functionality of timber/timber by bootstrapping essential functions and configurations commonly used within a WordPress theme. It streamlines theme development by automating key tasks, such as loading environment variables, setting up Timber contexts, and applying custom Twig filters.

Installation

To install this package, run the following command using Composer:

composer require tomorrow/wp-bootstrap

Usage

Once installed, include this package in your theme's functions.php file to automatically initialize the main functionality:

<?php

use Tomoorrow\Bootstrap;

// Load Composer's autoloader
require_once get_template_directory() . '/vendor/autoload.php';

// Load the main site class instance
new Bootstrap();

Configuration

While the Tomorrow\Bootstrap package works out-of-the-box, you can customize its behavior by extending the class and methods.

Environment Variables

The package looks for a .env file located outside the WordPress directory (one level above ABSPATH). If found, it loads the environment variables automatically. Use $_ENV to access these variables in your theme.

Twig Filters

Custom Twig filters can be added or modified by extending the add_to_twig() method.

Contributing

Contributions are welcome! If you have an idea for improving this package or find a bug, feel free to submit a pull request or open an issue on GitHub.

Steps to Contribute

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Write your code, along with tests if applicable.
  4. Submit a pull request with a clear description of your changes.

License

This package is licensed under the MIT license