A look at Rareloop's new WordPress starter theme (and framework), Lumberjack 2. The slides cover what problem it solves and some of the features it includes.
18. Lumberjack 1
• Launched end of 2015
• Aimed to make development more sane, came up with some conventions
19. Lumberjack 1
• Launched end of 2015
• Aimed to make development more sane, came up with some conventions
• Built on two open source projects
20. Lumberjack 1
• Launched end of 2015
• Aimed to make development more sane, came up with some conventions
• Built on two open source projects
• Timber
21. Lumberjack 1
• Launched end of 2015
• Aimed to make development more sane, came up with some conventions
• Built on two open source projects
• Timber
• Bedrock
22. Lumberjack 1
• Launched end of 2015
• Aimed to make development more sane, came up with some conventions
• Built on two open source projects
• Timber
• Bedrock
• Stopped short of being a full framework
51. $context = Timber::get_context();
// Get custom meta from current page
$context['customTitle'] = get_post_meta(the_ID(), 'customTitle');
$context['customDescription'] = get_post_meta(the_ID(), 'customDescription');
// Get list of posts to show
$context['posts'] = Timber::get_posts();
Timber::render('index.twig', $context);
index.php
52. namespace App;
use RareloopLumberjackHttpResponsesTimberResponse;
use RareloopLumberjackPost;
use TimberTimber;
class IndexController
{
public function handle()
{
$context = Timber::get_context();
// Get custom meta from current page
$context['customTitle'] = get_post_meta(the_ID(), 'customTitle');
$context['customDescription'] = get_post_meta(the_ID(), 'customDescription');
// Get list of posts to show
$context['posts'] = Timber::get_posts();
}
}
Timber::render('index.twig', $context);
index.php
53. namespace App;
use RareloopLumberjackHttpResponsesTimberResponse;
use RareloopLumberjackPost;
use TimberTimber;
class IndexController
{
public function handle()
{
$context = Timber::get_context();
// Get custom meta from current page
$context['customTitle'] = get_post_meta(the_ID(), 'customTitle');
$context['customDescription'] = get_post_meta(the_ID(), 'customDescription');
// Get list of posts to show
$context['posts'] = Timber::get_posts();
}
}
Timber::render('index.twig', $context);
extends BaseController
index.php
54. namespace App;
use RareloopLumberjackHttpResponsesTimberResponse;
use RareloopLumberjackPost;
use TimberTimber;
class IndexController
{
public function handle()
{
$context = Timber::get_context();
// Get custom meta from current page
$context['customTitle'] = get_post_meta(the_ID(), 'customTitle');
$context['customDescription'] = get_post_meta(the_ID(), 'customDescription');
// Get list of posts to show
$context['posts'] = Timber::get_posts();
}
}
Timber::render('index.twig', $context);
extends BaseController
index.php
55. namespace App;
use RareloopLumberjackHttpResponsesTimberResponse;
use RareloopLumberjackPost;
use TimberTimber;
class IndexController
{
public function handle()
{
$context = Timber::get_context();
// Get custom meta from current page
$context['customTitle'] = get_post_meta(the_ID(), 'customTitle');
$context['customDescription'] = get_post_meta(the_ID(), 'customDescription');
// Get list of posts to show
$context['posts'] = Timber::get_posts();
}
}
return new TimberResponse('index.twig', $context);
extends BaseController
index.php
56. Controller Benefits
• Procedural -> Object Orientated code
• Can use inheritance to extend a base class for common functionality
• Can encapsulate more complex routines in private functions
• Make use of PSR-7 compliant Response objects
72. Router benefits
• Extend WordPress site with custom URL endpoints
• Access to all REST based verbs
• Can add Groups, for collecting similar resources together
• PSR-15 compatible Middleware
76. class Product extends Post
{
public function getPhotos() : array
{
// Do database query to get the assigned photos
}
}
Encapsulate Business Logic
77. class Product extends Post
{
public function getPhotos() : array
{
// Do database query to get the assigned photos
}
}
Encapsulate Business Logic
$product = new Product(123);
$photos = $product->getPhotos();
88. Out the box config
• Post Type Registration
• Image sizes
89. Out the box config
• Post Type Registration
• Image sizes
• Logging
90. Out the box config
• Post Type Registration
• Image sizes
• Logging
• Menu’s
91. Out the box config
• Post Type Registration
• Image sizes
• Logging
• Menu’s
• Timber load paths
92. Out the box config
• Post Type Registration
• Image sizes
• Logging
• Menu’s
• Timber load paths
• Basic theme support (e.g. enable Featured Image support)
103. Give it a try
Lumberjack 2 Starter Theme
https://github.com/rareloop/lumberjack/tree/v2
104. Give it a try
Lumberjack 2 Framework
https://github.com/rareloop/lumberjack-core
Lumberjack 2 Starter Theme
https://github.com/rareloop/lumberjack/tree/v2
105. Give it a try
Lumberjack 2 Framework
https://github.com/rareloop/lumberjack-core
Lumberjack 2 Starter Theme
https://github.com/rareloop/lumberjack/tree/v2
@joelambert@rareloop
106. Give it a try
Lumberjack 2 Framework
https://github.com/rareloop/lumberjack-core
Lumberjack 2 Starter Theme
https://github.com/rareloop/lumberjack/tree/v2
Warning - this is still beta!!
@joelambert@rareloop