This commit is contained in:
Kevin Tessier 2020-06-14 15:59:06 +02:00
parent 4e25309391
commit 1fb5efd7dc
6 changed files with 29 additions and 45 deletions

View File

@ -7,8 +7,10 @@ $timber_post = new Timber\Post();
$args = array( $args = array(
'post_type' => 'post', 'post_type' => 'post',
'post_status'=>'publish',
); );
$context['posts'] = Timber::get_posts( $args ); $context['posts'] = Timber::get_posts( $args );
$context['terms'] = Timber::get_terms(array( 'taxonomy'=> 'category', 'hide_empty' => true, 'parent' => 0));
Timber::render('agenda.twig', $context ); Timber::render('agenda.twig', $context );

View File

@ -20,6 +20,7 @@ foreach ( $categories as $category ) {
} }
$current_id[] = get_the_ID(); $current_id[] = get_the_ID();
$args = get_posts(array( $args = get_posts(array(
'post_type' => 'post', 'post_type' => 'post',
'post_status' => 'publish', 'post_status' => 'publish',

View File

@ -1,35 +0,0 @@
<?php
/**
* The Template for displaying all single posts
*
* Methods for TimberHelper can be found in the /lib sub-directory
*
* @package WordPress
* @subpackage Timber
* @since Timber 0.1
*/
$context = Timber::context();
$timber_post = Timber::query_post();
$context['post'] = $timber_post;
$categories = get_the_terms( $id, 'category' );
foreach ( $categories as $category ) {
$cat = $category->slug;
}
$current_id[] = get_the_ID();
$args = get_posts(array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => -1,
'category_name' => $cat,
'post__not_in' => $current_id,
));
$context['other'] = $args;
Timber::render('single.twig', $context );

View File

@ -2,10 +2,19 @@
{% block content %} {% block content %}
<section> <section>
<ul class="cat-list d-flex flex-wrap">
{% for cat in terms %}
<a data-filter=".{{cat.slug}}" href="#">
<li>{{cat.name}}</li>
</a>
{% endfor %}
</ul>
<div class="row align-items-start"> <div class="row align-items-start">
{% for item in posts %} {% for item in posts %}
{% include 'components/thumbnails/thumbnails.twig'%} {% include 'components/thumbnails/thumbnails.twig'%}
{% endfor %} {% endfor %}
</div> </div>
</section> </section>
{% endblock %} {% endblock %}

View File

@ -1,9 +1,14 @@
{% set cat = item.categories|last %}
<div class="item thumbnails col-md-4 col-sm-6"> <div class="item thumbnails col-md-4 col-sm-6 {{cat.slug}} {{post.category.slug}}">
<a href="{{site.url}}/{{item.slug}}"> <a href="{{site.url}}/{{item.post_name}}">
<div class="__images">
<div class="__img"> <div class="__images">
<img src="{{ Image(item.image_event).src|resize(500, 500) }}" > <div class="icone_cat ">
</div>
<div class="__img">
<img src="{{ Image(item.image_event).src|resize(500, 500) }}" >
</div> </div>
</div> </div>

View File

@ -1,7 +1,6 @@
{% extends "base.twig" %} {% extends "base.twig" %}
{% block content %} {% block content %}
<div class="content-wrapper"> <div class="content-wrapper">
<article class="post-type"> <article class="post-type">
<img src="{{ Image(post.image_event).src |resize(600, 600) }}" /> <img src="{{ Image(post.image_event).src |resize(600, 600) }}" />
<section class="article-content"> <section class="article-content">
@ -20,6 +19,9 @@
</div> </div>
</div> </div>
<div class="lieu">{{post.lieu}}</div> <div class="lieu">{{post.lieu}}</div>
<div class="cat {{post.category.slug}}">
{{post.category.name}}
</div>
</div> </div>
<div class="article-body"> <div class="article-body">
<p>{{post.description}}</p> <p>{{post.description}}</p>
@ -66,7 +68,7 @@
</div> </div>
<div class="other-posts"> <div class="other-posts">
{% for item in other %} {% for item in other %}
{% include 'components/thumbnails/thumbnails.twig' %} {% include 'components/thumbnails/thumbnails.twig' %}
{% endfor %} {% endfor %}
</div> </div>