Skip to content

Create page template and load specific component on it #460

Answered by aaronmeder
comsup asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @comsup

That shouldn't differ from the standard procedure with WP.

  1. Create the Template file, e.g. template-specialsite.php in your Flynt theme folder
  2. Add a comment with the "Template Name: Special Site Template" to the header of the file. Example:
<?php

/* Template Name: Special Site Template */

use Timber\Timber;
use Timber\Post;

$context = Timber::get_context();
$context['post'] = new Post();

Timber::render('templates/page.twig', $context);
  1. Then proceed by setting up and loading a specific twig-template if you want, as you already described it.

This will make it show up in Wordpress Admin:

Does that help?

Greetings from Zurich 🇨🇭
Aaron

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@comsup
Comment options

@aaronmeder
Comment options

@aaronmeder
Comment options

@comsup
Comment options

@comsup
Comment options

Answer selected by comsup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants