Created
July 27, 2013 17:32
-
-
Save jarednova/6095599 to your computer and use it in GitHub Desktop.
Twig / Timber if/else
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if post.thumbnail %} | |
<img src="{{post.thumbnail.src}}" /> | |
{% elseif post.heroimage %} | |
<img src="{{post.heroimage.src}}|resize(300, 300)" /> | |
{% else %} | |
<img src="/wp-content/themes/mytheme/default-image.jpg" /> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can read the Twig docs on conditionals:
http://twig.sensiolabs.org/doc/tags/if.html