Skip to content

Instantly share code, notes, and snippets.

@jarednova
Created January 15, 2015 23:04
Show Gist options
  • Save jarednova/7dd9e3eab9375f43c9e6 to your computer and use it in GitHub Desktop.
Save jarednova/7dd9e3eab9375f43c9e6 to your computer and use it in GitHub Desktop.
$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;
Timber::render('loop.twig', $data);
{% for a in artists %}
%a.artist-card{:href => "{{a.link}}", :id => "artist-{{a.ID}}"}
{% for p in a.portfolios %}
Portfolio {{loop.index}}
{% endfor %}
{{ a.slug }}
%h3 {{ a.title }}
{% if a.get_field('artist_bio') %}
{% endif %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment