wp_enqueue_scripts
, admin_enqueue_scripts
, or login_enqueue_scripts
hooks. This notice was triggered by the codepen-embed-script
handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/jwblogger/jwBlogger/wp-includes/functions.php on line 6114I got to admit, I was very very excited when I finally discovered Timber<\/a>, a tool that creates the ability to use Twig <\/a>templates with WordPress. As a front-end developer, using Twig templates allows me to focus more on the HTML I need to create. It frees me from polluting my templates with random PHP functions, and I can create reusable template snippets that I can use in other projects. To put in another way, Twig allows me to abstract PHP and server-side code out of my HTML templates so that I can focus better on the markup I need to develop. I’m not scared of PHP – I just don’t want to think about it when I’m working on client-side markup.<\/p>\n Without Twig, here is the code you need to write to display an image:<\/p>\n And thats just for a thumbnail image. Imagine using this code to show a gallery of images, or if you had to use a srcset<\/span> attribute to ensure the appropriate image gets loaded, given the user’s screen size.<\/p>\n With Timber, that code now looks like:<\/p>\n Much cleaner and concise, yes? Ref: https:\/\/www.upstatement.com\/timber\/#object-oriented-posts-etc<\/a><\/p>\n Getting started with Timber was way easy. I followed the steps in “Setup<\/a>” tutorial with no problem – I love tools that come with clear and unambiguous instructions.<\/p>\n The first time I installed Timber, I installed the plugin found on WordPress.org<\/a>, Then I downloaded the Timber starter theme<\/a> so I could begin to play with the templates. No other configuration was necessary.<\/p>\n$thumb_id = get_post_thumbnail_id($post->ID);\n$url = wp_get_attachment_url($thumb_id);\n<img src=\"<?php echo $url; ?>\" alt=\"Thumbnail for <?php echo $post->post_title; ?>\" \/>\n<\/pre>\n
<img src=\"{{post.thumbnail.src}}\" alt=\"Thumbnail for {{ post.title }}\" \/><\/pre>\n
Getting Started<\/h2>\n
Useful Links<\/h2>\n