Replies: 2 comments 4 replies
-
Okay, I looked into this a little more and came across a lot of discussions that are all related to version 2 of Timber. I'm running on 1.20 and got it working on if (have_posts()) {
while(have_posts()) {
the_post();
$post = new Timber\Post();
$context['post'] = $post;
Timber::render('single.twig', $context, 600);
}
} Is this a legit way of doing it? Are there other, better options or would you recommend to just migrate to version 2? |
Beta Was this translation helpful? Give feedback.
-
Hi @kilianso Provided that I have "timberized" the header and footer of my theme, which inside has
Edit: of course the markup part depends on what you have in your theme :-) |
Beta Was this translation helpful? Give feedback.
-
Hi all! I've seen some discussion on the topic of how to use Timber in plugin templates. But this is not my question. I use Learndash to sell courses. Learndash has a lot of templates and assets that are in the plugin directory in a theme called ld30. There are routes like
/courses/courseXY
and/lessons/lessonXY
.Now instead of picking the plugin templates, my Timber based theme just uses the default
archive.php
andsingle.php
files when I go to these routes. And of course, because of this, the entire user interface and functionality of the plugin doesn't work. What am I missing?Even if I could create pages like
archive-sfwd-courses.php
andsingle-sfwd-courses.php
etc and then place plugin shortcodes and functions on them, it would be a huge effort and most likely I would miss some of the functions and edge cases covered by the built-in templates. So I would prefer to use their templates rather than create my own ones from scratch. Even if I copy all the related files to my theme's root directory (as stated in this article), it doesn't work.If I switch to another Wordpress default theme that is not based on Timber, it works as expected. It's hard to determine if this is a compatibility issue between Learndash and Timber, or something general that I'm overlooking that occurs with any plugin that provides its own templates.
Here's the theme i'm building: https://github.com/kilianso/woodplane
Beta Was this translation helpful? Give feedback.
All reactions