
Editor for Timber
v1.0.2dweipert · 2020年10月29日 上架
Page, Theme & Plugin Editor Extension for Timber http://www.upstatement.com/timber/
- 正在使用
- 50+
- 评分
- 暂无
- 累计下载
- 2,314
- 最近更新
- 2020年12月16日
需要 WordPress 5.5+已测试到 5.5.25PHP 7.4+
贡献者
Features
- adds a metabox to configurable Post-Types to create and edit Twig templates
- adds Twig support to the WP Theme & Plugin editors
- you can even customize the CodeMirror theme
Plugin Dependencies
- https://wordpress.org/plugins/timber-library/
- https://wordpress.org/plugins/classic-editor/
How to use the MetaBox Feature
The plugin uses the path defined in Timber::$locations as the templates path or falls back to the uploads folder if none is provided.
Either adjust your Timber::render('page.twig', $context)-functions like this:
$filenames = [TimberEditor::getTemplateFilename(), 'page.twig'];
Timber::render($filenames, $context);
like this
TimberEditor::render('page.twig', $context);
# 'page.twig' serves as a fallback if the current posts's template doesn't exist
or like this
TimberEditor::renderPost('page.twig', $context);
# renderPost() automatically adds ['post' => new Timber\Post()] to the $context