Skip to content

Instantly share code, notes, and snippets.

View jarednova's full-sized avatar
🗽

Jared Novack jarednova

🗽
View GitHub Profile
<?php
$context = Timber::get_context();
$context['work'] = Timber::get_posts('post_type=work&numberposts=25');
$context['posts'] = Timber::get_posts();
Timber::render('index.twig', $context);
<?php
$test = function(){
echo 'test works';
};
$test();
<?php
/* mods/side-nav.twig */
class __TwigTemplate_0a76428590b54c4ba53bab18b8522f90b76d43e3ebb0782a476f00875fbab93a extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
Date is {{post.ee.event_start_date}}
$artists = Timber::get_posts($artist_args);
foreach( $artists as $artist ) {
$connected = new WP_Query( array(
'connected_type' => 'portfolios_to_artists',
'connected_items' => $artist,
'nopaging' => true
) );
$artist->portfolios = Timber::get_posts($connected);
}
$data['artists'] = $artists;
$post = new TimberPost();
$context['post'] = $post;
$category = $post->category(); // this will be a TimberTerm assuming there's 1 or more category assigned to this post
$query = array('posts_per_page' => 6, 'cat' => $category->ID, 'post__not_in' => array($post->ID));
$context['latest'] = Timber::get_posts($query);
//the rest as you had it in your gist
* {
box-sizing: border-box;
}
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
{{ post.get_field('my_field") }}
  • Whatever
Nice dfsd
dfasd