From 1aa1ff5ca807d10039a5a06b9972a0d4d062fa01 Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@tetras-libre.fr> Date: Fri, 25 Jan 2019 13:27:02 +0100 Subject: [PATCH] Show categories descriptions --- posts.php | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/posts.php b/posts.php index 0f69dc9..acbb743 100644 --- a/posts.php +++ b/posts.php @@ -3,37 +3,26 @@ <section class="content"> <?php $title="Blog"; + $text=""; if (preg_match('/category.*/',current_url())){ echo "<p id='".current_url()."'></p>"; while(categories()){ echo "<p id='".category_url()."'></p>"; if(category_url() == "/".current_url()){ $title.=" - ".category_title(); + $text="<div class='wrap'><p>".category_description()."</p>"; + $text.="<p>Cette catégorie regroupe ".category_count()." ".pluralise(category_count(), "article", "s")."</p></div>"; } } } echo "<h1 style='text-align:center'>$title</h1>\n"; + echo $text; ?> <?php if(has_posts()): ?> <?php posts(); ?> <h2> Dernier article </h2> <?php include("single_article.php"); ?> - <!-- - <?php if (!preg_match('/category.*/',current_url())): ?> - <h2> Catégories d'articles </h2> - <ul style="list-style:none"> - <?php $i = 0; while(categories()): ?> - <?php if(category_count() > 0 ):?> - <li > - <?php include("single_category.php"); ?> - </li> - <?php endif; ?> - <?php endwhile; ?> - </ul> - <?php endif; ?> - --> - <?php if(total_posts() > 1 || $title=="Blog"):?> <h2> Articles précédents </h2> <ul class="items"> -- GitLab