@colin_howells You’re in luck! I’m giving a talk tomorrow at WordCamp Lancaster all about Twig and WordPress and my project Sprig. Here are the slides v.gd/wptemplating
It will probably be recorded and then I’ll share the video.
@colin_howells You’re in luck! I’m giving a talk tomorrow at WordCamp Lancaster all about Twig and WordPress and my project Sprig. Here are the slides v.gd/wptemplating
It will probably be recorded and then I’ll share the video.
@colin_howells Start by using a separate PHP file for templating and go from there.
@colin_howells So with that I created Sprig so I could use Twig to pass date to templates and use WordPress’ escaping functions as Twig filters.
Pros:
– Separation of logic from presentation
– Reusability
Cons:
– It’s a separate dependency
– Slight learning curve
@colin_howells @TimberWP Then I read carlalexander.ca/designing-class… from @twigpress and it clicked that you want to pass data to function and let it render the data into a template so it can be reuseable and not tied to WordPress post. It can be reused with different data dynamically or statically.
@colin_howells Then I realized all of the places I’ve seen it being used (like @TimberWP ) is the same way as using inline PHP but a different language. There was a lot of work done to make Twig versions of PHP things and it was really weird to me.
@colin_howells Oh man I’ve got a talk forming in my head about my journey with templating. I used to hate Twig because I didn’t see the need.
@kingkool68
WordPress developer at @CoderPad. Formerly of @nclud @spiritedmediaco, @pewresearch, @usnews. I made dummyimage.com and married @naudebynature.