Skip to content

Instantly share code, notes, and snippets.

View jarednova's full-sized avatar
🗽

Jared Novack jarednova

🗽
View GitHub Profile
<h1>Congratulations to {{name}}</h1>
<p>You're really great so we're giving you a prize of {{prize}}</p>
<?php
$data = Timber::get_context();
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('posts_per_page=2&paged='.$paged);
$posts = Timber::get_posts();
$data['posts'] = $posts;
$data['pagination'] = Timber::get_pagination();
Timber::render('date.twig', $data);
@jarednova
jarednova / client-article.php
Last active July 13, 2016 12:33
### Let's maximize best practice. From my perspective this means making objects out of our Article so we can handle they byline permutations:
<?php
/* client-article.php */
class ClientArticle extends TimberPost {
function writers(){
return $this->get_terms('writers', true, 'ClientWriter');
}
Nice dfsd
dfasd
@jarednova
jarednova / gist:6095599
Created July 27, 2013 17:32
Twig / Timber if/else
{% 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 %}
  • Whatever