From 61109e89fbf924df473344370621f86b40c9c4eb Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@tetras-libre.fr> Date: Fri, 25 Jan 2019 13:20:26 +0100 Subject: [PATCH] Wip better nav --- article.php | 2 -- css/style.css | 10 +++++----- functions.php | 17 ++++++++++++++++- posts.php | 21 ++++++++------------- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/article.php b/article.php index 1fa1f01..72c9ae1 100644 --- a/article.php +++ b/article.php @@ -20,9 +20,7 @@ <?php echo total_comments();?> <?php echo pluralise(total_comments(), "commentaire", "s") ?>.<?php endif; ?> <?php echo article_custom_field('attribution'); ?></p> <ul style="list-style:none;box-sizing:border-box"> <li style="float:left;padding:15px"><a href="<?php echo article_previous_url()?>">Article précédent</a></li> - <!-- <li style="float:left;padding:15px"><a href="<?php echo article_category_url()?>">Tous les articles de la catégorie <?php echo article_category();?></a></li> - --> <li style="float:left;padding:15px"><a href="<?php echo article_next_url()?>">Article suivant</a></li> </ul> </section> diff --git a/css/style.css b/css/style.css index 79c29ca..e94177d 100644 --- a/css/style.css +++ b/css/style.css @@ -18,11 +18,9 @@ h2{ } #top { - overflow: hidden; padding: 20px 35px; margin: 20px; background: #fff; - border-bottom: 1px solid rgba(22,54,36,.1); } #top a { float: left; @@ -76,12 +74,13 @@ h2{ } .items > li { padding: 70px 0 60px; + border-bottom: 1px solid; - color: #97c9ae; - background: #3c4552; + #color: #97c9ae; + #background: #3c4552; } .posts .items > li:first-child { - background: #fff !important; + #background: #fff !important; padding: 110px 0; } .items li h1 a, .posts .items > li:first-child h2 a { @@ -151,6 +150,7 @@ h2{ */ .content { padding: 10px 0px; + border-top: 1px solid rgba(22,54,36,.1); } .content ul, .content ol, .items li ul { padding: 20px 30px; diff --git a/functions.php b/functions.php index 4ef37f5..ff6ae60 100644 --- a/functions.php +++ b/functions.php @@ -137,7 +137,22 @@ function build_menu($parent, $tree){ echo '</ul>'; echo '</li>'; }else{ - print_item($item, $class); + if(menu_name($item) == "Blog"){ + echo '<li class="dropdown '.$class.'"><a class="dropdown-toggle" data-toggle="dropdown" href="#">'.menu_name($item).'<span class="caret"></span></a>'; + echo '<ul class="dropdown-menu">'; + echo '<li><a href="'.menu_url($item).'" title="Tous les articles">'; + echo 'Tous les articles </a></li>'; + while(categories()){ + if(category_count() > 0 ){ + echo '<li><a href="'.category_url().'" title="'.category_title().'">'; + echo category_title().' </a></li>'; + } + } + echo '</ul>'; + echo '</li>'; + }else{ + print_item($item, $class); + } } } } diff --git a/posts.php b/posts.php index 6ac5730..0f69dc9 100644 --- a/posts.php +++ b/posts.php @@ -15,41 +15,36 @@ echo "<h1 style='text-align:center'>$title</h1>\n"; ?> <?php if(has_posts()): ?> - <ul class="items"> <?php posts(); ?> - <li> <h2> Dernier article </h2> <?php include("single_article.php"); ?> - </li> + <!-- <?php if (!preg_match('/category.*/',current_url())): ?> - <li id="<?php echo current_url();?>" style="background:none"> <h2> Catégories d'articles </h2> + <ul style="list-style:none"> <?php $i = 0; while(categories()): ?> - <?php $bg = sprintf('background: hsl(131, 6%%, %d%%);', round(50-(($i / total_categories()) * 20))); ?> <?php if(category_count() > 0 ):?> - <?php ++$i; ?> - <li style="<?php echo $bg; ?>"> + <li > <?php include("single_category.php"); ?> </li> <?php endif; ?> <?php endwhile; ?> - </li> + </ul> <?php endif; ?> - --> + --> <?php if(total_posts() > 1 || $title=="Blog"):?> - <li style="background:none"> <h2> Articles précédents </h2> + <ul class="items"> <?php $i = 0; while(posts()): ?> - <?php $bg = sprintf('background: hsl(131, 6%%, %d%%);', round(50-((++$i / posts_per_page()) * 20))); ?> - <li style="<?php echo $bg; ?>"> + <li > <?php include("single_article.php"); ?> </li> <?php endwhile; ?> </li> + </ul> <?php endif?> - </ul> <?php if(has_pagination()): ?> <nav class="pagination"> -- GitLab