Skip to content

Instantly share code, notes, and snippets.

View jarednova's full-sized avatar
🗽

Jared Novack jarednova

🗽
View GitHub Profile
@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 %}
$context = Timber::get_context();
$context['slides'] = Timber::get_posts('post_type=slides');
$context['pages'] = Timber::get_posts('post_type=page&posts_per_page=2');
$context['portfolio'] = Timber::get_posts('post_type=portfolio');
$context['posts'] = Timber::get_posts(); //leave blank for default page query
Timber::render('front-page.twig', $context);
@jarednova
jarednova / base.twig
Last active March 23, 2022 12:30
Timber Hello World
{# This is a Twig comment, it won't output to the browser #}
<html>
<head>
<title>{{ wp_title }}</title>
</head>
{% block content %}
<!-- This will be overwritten by the content block in the inheriting .twig file -->
{% endblock %}
</html>
body {
color: purple;
background-color: gray;
}

Character List

Real Life H:LOTS Character Actor
Lt. Gary D'Addario Al Giardello Yaphet Kotto
Det. Sgt. Terrence McLarney Steve Crosetti Jon Polito
Det. Donald Worden Stan Bolander Ned Beaty
Det. Rick James
Det. Ed Brown
Det. Donald Waltermeyer Meldrick Lewis Clark Johnson
<?php
class ClientEvent extends ClientPost {
protected $_venue;
protected $_hosts;
protected $_master_id;
protected $_is_alt_event; // whether or not this instance is an alt date/time of another event
protected $_is_alt_event_or_master; // whether or not this instance is an alt event or a master with alts
/**
* @param Twig_LoaderInterface $loader
* @param array $environment_args
*
* @return Twig_Environment
*/
public function get_twig_environment( $loader, $environment_args ) {
return new \Twig\Environment( $loader, $environment_args );
}
@jarednova
jarednova / require-timber.php
Created January 12, 2015 19:46
Require timber in mu-plugins
<?php
require_once('../plugins/timber-library/timber.php');
@jarednova
jarednova / functions.php
Last active November 24, 2018 21:00
example of easy shortcodes you can add in functions.php
<?php
add_shortcode( 'section-break', function($attributes = array(), $content = null) {
return '<div class="article-body-section-break"></div>';
} );
add_shortcode( 'email-tease', function($attributes = array(), $content = null) {
return Timber::compile('partials/newsletter.twig', array('context_class' => 'newsletter-signup--in-article', 'text' => $content));
} );

Is Kosher

Easy

  • Is it vegetarian? It's kosher! All done!

Fish

  • Regular fish (tuna, salmon, cod, etc.)

Chicken & Beef

  • If it's "kosher" meat (from a Kosher butcher or some grocery stores have a kosher meat section) AND