Important: Course has been updated in July 2020. Chapter 3 and 4 are live with more information and also increased font size.
Default WordPress templating system has some weaknesses. I will show you how to use Twig and Timber to create themes with modern approach where template is separated from the controller, templates are clean and readable just like in HTML with some extra features.
Important: Course has been updated in July 2020. Chapter 3 and 4 are live with more information and also increased font size.
Default WordPress templating system has some weaknesses. I will show you how to use Twig and Timber to create themes with modern approach where template is separated from the controller, templates are clean and readable just like in HTML with some extra features.
You will learn basics about Twig and Timber and how to use it in WordPress. As the project we are going to create a website from scratch using this environment. PHP and Bootstrap knowledge is useful bot not required. The only requirement is basic knowledge about HTML and CSS to understand the code.
Additional information:
This course is more like an introduction, we are going to stay near the beginner level for most of the time. It is not a full guide covering all features of Twig or Timber.
Basic information about this course:
Who is this course for?
Why would you use Twig & Timber?
List of contents
Course project - website
Additional information
How Timber and Twig work in Wordpress environment. Explanation based on templating example.
Process of creating new Wordpress installation with Twig and Timber environment to encourage you to join this course. All the steps are going to be explain in next chapters.
Install Local by Flywheel and create new website.
Install Visual Studio Code and extension that helps developing in Twig.
Install Composer to later use it for Timber installation.
Basic information about Twig and Timber and where you should search for information about it.
What is a variable and how to output it.
Understand data types, in first part you will learn about string, number, boolean and null.
Understand data types, in second part you will learn about array and hash.
Understand basics of template inheritance - one of the best Twig features, using tags block, extends and parent function
Conditional logic with if tag, execute some code based on some condition.
Different syntax for conditional logic - ternary operator - that you can use instead of if block.
Introduction to for loop that is used to run the same code multiple times, to iterate in a sequence of items.
More information and different usage of for loop.
Reusable pieces of code are another thing about templating in twig. Learn how to do it with macro and include.
More information about macro, how to set default values, call macro from the same file and special variable varargs.
Quick example to practice templating and visualize the rendering process.
Learn how to modify the variable before outputting to the HTML.
Learn how to use functions with some examples.
Explanation about available operators (logic, math, is, in) and how to perform a test.
Understand what is a truthy and falsy value in comparison to true and false.
HTML and Twig comments compared and also how to use dump function for debugging.
How to install Timber and how it connects Twig and WordPress. Also about two template hierarchies used in this environment to render initial .twig file.
Examples of data that you can grab from the context using post. site. and theme.
Learn how to add your own variables to the context in controller file (local) and also in functions (global). Also about using Advanced Custom Fields to send data from WP backend to the .twig template.
Few examples of different Timber features to give you an idea of how many things Timber has to offer.
How to install and use Timber Starter Theme as great starting point for you project.
In this lesson we are going to learn what you should remember before deploying website and how to do it.
In this lesson we are going to create more complicated macro example.
In this lesson we are going to learn what is Bootimber theme, how you can use it to develop in a more efficient way.
OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.
Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.
Find this site helpful? Tell a friend about us.
We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.
Your purchases help us maintain our catalog and keep our servers humming without ads.
Thank you for supporting OpenCourser.