upstatement / timber-starter-theme
Starter theme to build a Timber theme
Installs: 5 491
Dependents: 0
Suggesters: 0
Security: 0
Stars: 801
Watchers: 44
Forks: 271
Type:wordpress-theme
Requires
- timber/timber: 2.x-dev
Requires (Dev)
- automattic/wordbless: ^0.4.2
- yoast/wp-test-utils: ^1.0
- 2.x-dev
- 2.0.0
- 1.x-dev
- 1.2
- 1.1
- 1.0
- dev-chore-introduce-code-styles
- dev-chore-add-pr-template
- dev-feat-static-to-assets
- dev-feat-update-template-basis
- dev-chore-update-license-readme-style
- dev-update-composer-file
- dev-delete-sidebar
- dev-update-template-php-files
- dev-150-simplify-headerfooter-usage
- dev-master
This package is not auto-updated.
Last update: 2024-05-14 15:16:21 UTC
README
The "_s" for Timber: a dead-simple theme that you can build from. The primary purpose of this theme is to provide a file structure rather than a framework for markup or styles. Configure your SASS files, scripts, and task runners however you would like!
Installing the theme
Follow the guide on how to Install Timber using the Starter Theme.
Then,
- Rename the theme folder to something that makes sense for your website. You could keep the name
timber-starter-theme
but the point of a starter theme is to make it your own! - Activate the theme in the WordPress Dashboard under Appearance → Themes.
- Do your thing! And read the docs.
The StarterSite
class
In functions.php, we call new StarterSite();
. The StarterSite
class sits in the src folder. You can update this class to add functionality to your theme. This approach is just one example for how you could do it.
The src folder would be the right place to put your classes that extend Timber’s functionality.
Small tip: You can make use of Composer’s autoloading functionality to automatically load your PHP classes when they are requested instead of requiring one by one in functions.php.
What else is there?
static/
is where you can keep your static front-end scripts, styles, or images. In other words, your Sass files, JS files, fonts, and SVGs would live here.views/
contains all of your Twig templates. These pretty much correspond 1 to 1 with the PHP files that respond to the WordPress template hierarchy. At the end of each PHP template, you’ll notice aTimber::render()
function whose first parameter is the Twig file where that data (or$context
) will be used. Just an FYI.tests/
... basically don’t worry about (or remove) this unless you know what it is and want to.
Other Resources
- This branch of the starter theme has some more example code with ACF and a slightly different set up.
- Twig for Timber Cheatsheet
- Timber and Twig Reignited My Love for WordPress on CSS-Tricks
- A real live Timber theme.
- Timber Video Tutorials and an incomplete set of screencasts for building a Timber theme from scratch.