Kevin 4 years ago
parent
commit
1fb5efd7dc

+ 2 - 0
web/app/themes/la_mine/agenda.php

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

+ 1 - 0
web/app/themes/la_mine/single.php

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

+ 0 - 35
web/app/themes/la_mine/single0.php

@@ -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 );

+ 12 - 3
web/app/themes/la_mine/templates/agenda.twig

@@ -2,10 +2,19 @@
 
 {% block content %}
 	<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">
-		{% for item in posts %}
-			{% include 'components/thumbnails/thumbnails.twig'%}
-		{% endfor %}
+			{% for item in posts %}
+				{% include 'components/thumbnails/thumbnails.twig'%}
+			{% endfor %}
 		</div>
+
 	</section>
 {% endblock %}

+ 10 - 5
web/app/themes/la_mine/templates/components/thumbnails/thumbnails.twig

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

+ 4 - 2
web/app/themes/la_mine/templates/single.twig

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