-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Twig templates as theme templates #43
Comments
Just to further this. I have tried to create a custom template in wordpress.yaml in the hopes this could be routed to a twig file, or I could find a way to do it: wordpress.yaml
But trying to set this template when editing a page throws the error:
|
Hi @aroberts91 nice catch, I'm working on a fix right now. I keep you up to date. |
@aroberts91 the issue was in the wp-steroids plugin. I have published a new version with a fix. Here is a code sample on how to use it. In your action, you need to get the template from the post object: public function pageAction(Post $post)
{
$template = $post->getTemplate()?:'page';
return $this->render('pages/'.$template.'.html.twig', [
'post'=>$post
]);
} Let me know :) |
@jerome-barbato Thanks! I'll give it a try and let you know asap |
Is there a way to use twig files as themes which a user can select when editing a page in wp admin? Or does this still need to be handled by a Wordpress theme?
I would like to give the user the ability to choose between a number of templates but still have access to twigs templating functionality
The text was updated successfully, but these errors were encountered: