Compare commits

..

7 commits

Author SHA1 Message Date
Kazhnuz
b4de4468c1 fix: correction affichage des images articles 2023-03-12 17:30:00 +01:00
Kazhnuz
8051a2b947 fix: correction taille miniatures 2023-03-12 17:28:10 +01:00
Kazhnuz
5c087201ed feat: ajout support miniatures 2023-03-12 17:24:01 +01:00
Kazhnuz
7817f3999a feat: ajout temps de lecture
Fixes #20
2023-03-12 16:26:45 +01:00
Kazhnuz
bfc18a3cf6 fix: retirer commentaires
Fixes #34
2023-03-12 16:16:21 +01:00
Kazhnuz
365781adbc feat: mutli-categories 2023-03-12 16:15:46 +01:00
Kazhnuz
af058e2d8c feat: add link page 2022-12-18 19:19:04 +01:00
13 changed files with 186 additions and 58 deletions

View file

@ -6,6 +6,7 @@
<article class="article container-article" id="post-<?php the_ID(); ?>">
<?php if ($haveTitle) { ?>
<h1 class="page-title"><?php the_title(); ?></h1>
<p class="text-right"><span class="btn-small btn-secondary"> <?php echo reading_time(); ?> </span></p>
<?php } ?>
<div class="article-entry">
@ -29,7 +30,5 @@
</div>
</section>
<?php comments_template(); ?>
<?php endwhile; ?>
<?php endif; ?>

View file

@ -7,8 +7,14 @@
foreach ($menu as $menuElement) {
echo '<li class="social-li"><a class="social-link" href="'. $menuElement->url .'" title="Accéder à mon '.$menuElement->title.'" aria-label="Accéder à mon '.$menuElement->title.'"><i class="fa fa-fw fa-'.$menuElement->title.'" aria-hidden="true"></i></a></li> ';
}
}
?>
<li class="social-li">
<a class="social-link" href="https://kazhnuz.space/links" title="Plus de liens" aria-label="Plus de liens">
<i class="fa fa-fw fa-ellipsis-h" aria-hidden="true"></i>
</a>
</li>
</ul>
<div class="footer-collumns">

View file

@ -1,19 +1,33 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-grey" id="navbar-category">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<?php
$parent_categories = get_categories( array(
'orderby' => 'slug',
'order' => 'ASC',
'parent' => 0
) );
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav nav-justified w-100">
foreach( $parent_categories as $parent_category ) {
?>
<li>
<span class="btn btn-navbar">
<?php echo $parent_category->name ?> <i class="fa fa-caret-down" aria-hidden="true"></i>
<ul class="card-menu">
<?php
$categories = get_categories( array(
'orderby' => 'name',
'order' => 'ASC'
'orderby' => 'slug',
'order' => 'ASC',
'parent' => $parent_category->term_id
) );
foreach( $categories as $category ) {
echo '<li class="nav-item"><a class="nav-link" href="' . get_category_link($category->term_id) . '">' . $category->name . '</a></li>';
}?>
if ($category->slug != "chapters") {
echo '<li><a class="menu-element" href="' . get_category_link($category->term_id) . '">' . $category->name . '</a></li>';
}
}
?>
</ul>
</div>
</nav>
</span>
</li>
<?php
}
?>

View file

@ -5,24 +5,7 @@
<i class="fa fa-home" aria-hidden="true"></i><span class="sr-only">Accueil</span>
</a>
</li>
<li>
<span class="btn btn-navbar">
Catégories <i class="fa fa-caret-down" aria-hidden="true"></i>
<ul class="card-menu">
<?php
$categories = get_categories( array(
'orderby' => 'name',
'order' => 'ASC'
) );
foreach( $categories as $category ) {
if ($category->slug != "blog" && $category->slug != "chapters") {
echo '<li><a class="menu-element" href="' . get_category_link($category->term_id) . '">' . $category->name . '</a></li>';
}
}?>
</ul>
</span>
</li>
<?php include(TEMPLATEPATH . '/components/navbar-category.php'); ?>
<?php
$listmenu = get_nav_menu_locations();
$menu = wp_get_nav_menu_items($listmenu['top-navbar']);

View file

@ -4,7 +4,17 @@
<article class="card card-preview card-primary">
<a href="<?php the_permalink(); ?>" class="preview-link">
<div class="preview-item">
<?php if(!has_post_thumbnail( $post->ID )) {
?>
<div class="preview-content" aria-hidden="true"><?php the_excerpt(); ?></div>
<?php
} else {
?>
<div class="preview-content" aria-hidden="true"><p class="p-img"><img class="preview-img" src="<?php echo get_the_post_thumbnail_url(); ?>" /></p></div>
<?php
}
?>
<div class="preview-overlay">
<h1 class="card-header"><?php the_title(); ?></h1>
<div class="preview-metadata">

View file

@ -1,16 +1,30 @@
<div class="card card-primary">
<div class="card-header"><i class="fa fa-folder" aria-hidden="true"></i> Catégories</div>
<?php
$parent_categories = get_categories( array(
'orderby' => 'slug',
'order' => 'ASC',
'parent' => 0
) );
foreach( $parent_categories as $parent_category ) {
?>
<div class="card card-primary">
<div class="card-header"><i class="fa fa-folder" aria-hidden="true"></i> <?php echo $parent_category->name ?></div>
<ul class="card-menu">
<?php
$categories = get_categories( array(
'orderby' => 'name',
'order' => 'ASC'
'orderby' => 'slug',
'order' => 'ASC',
'parent' => $parent_category->term_id
) );
foreach( $categories as $category ) {
if ($category->slug != "blog" && $category->slug != "chapters") {
if ($category->slug != "chapters") {
echo '<li><a class="menu-element" href="' . get_category_link($category->term_id) . '">' . $category->name . '<span class="menu-label label-secondary">'. $category->count . '</span></a></li>';
}
}?>
}
?>
</ul>
</div>
</div>
<?php
}
?>

View file

@ -4,5 +4,6 @@
<?php include(TEMPLATEPATH . '/components/footer-content.php'); ?>
<?php wp_footer(); ?>
<script src="<?php echo get_template_directory_uri();?>/js/trim.js"></script>
<script src="<?php echo get_template_directory_uri();?>/js/prettylinks.js"></script>
</body>
</html>

View file

@ -19,7 +19,7 @@
add_action( 'init', 'kspace_post_supports' );
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 825, 510, true );
set_post_thumbnail_size( 825, 825, true );
/* 1. Niveau support
*
@ -316,8 +316,25 @@ register_taxonomy('roman', 'post',
'top-navbar-2' => __( 'Navbar (droite)' ),
'link-menu' => __( 'Liste des liens' ),
'footer-pages' => __( 'Pages dans le footer' ),
'social' => __( 'Reseaux sociaux' )
'social' => __( 'Reseaux sociaux' ),
'social-plus' => __( 'Reseaux sociaux supplémentaires' ),
)
);
}
add_action( 'init', 'wpb_custom_new_menu' );
//estimated reading time
function reading_time() {
$content = get_post_field( 'post_content', $post->ID );
$word_count = str_word_count( strip_tags( $content ) );
$readingtime = ceil($word_count / 200);
if ($readingtime == 1) {
$timer = " minute";
} else {
$timer = " minutes";
}
$totalreadingtime = $readingtime . $timer;
return $totalreadingtime;
}

8
js/prettylinks.js Normal file
View file

@ -0,0 +1,8 @@
var length = 35;
$(function(){
$(".pretty-link").each(function(i){
var str = $(this).text().replace("https://", "");
$(this).text(str);
});
});

60
page-links.php Normal file
View file

@ -0,0 +1,60 @@
<?php /* Template Name: page-links */ ?>
<?php get_header(); ?> <!-- ouvrir header,php -->
<main>
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<article class="article-content" id="post-<?php the_ID(); ?>">
<h1 class="page-title"><?php the_title(); ?></h1>
<div class="article-body mb-2">
<?php the_content(); ?>
</div>
</article>
<div class="card card-primary">
<h2 class="card-header">Liste de mes réseaux sociaux</h2>
<table>
<thead>
<tr>
<th class="text-info">Réseau social</th>
<th class="text-right text-info">Lien</th>
</tr>
</thead>
<tbody>
<?php
$listmenu = get_nav_menu_locations();
$menu = wp_get_nav_menu_items($listmenu['social']);
if ($menu != null) {
foreach ($menu as $menuElement) {
?>
<tr>
<th><i class="fa fa-fw fa-<?php echo $menuElement->title; ?>" aria-hidden="true"></i> <span class="text-maj"><?php echo $menuElement->title; ?></span></th>
<td class="text-right"><a class="pretty-link" href="<?php echo $menuElement->url; ?>"><?php echo $menuElement->url; ?></td>
</tr>
<?php
}
}
?>
<?php
$listmenu = get_nav_menu_locations();
$menu = wp_get_nav_menu_items($listmenu['social-plus']);
if ($menu != null) {
foreach ($menu as $menuElement) {
?>
<tr>
<th><i class="fa fa-fw fa-<?php echo $menuElement->title; ?>" aria-hidden="true"></i> <span class="text-maj"><?php echo $menuElement->title; ?></span></th>
<td class="text-right"><a class="pretty-link" href="<?php echo $menuElement->url; ?>"><?php echo $menuElement->url; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<?php endwhile; ?>
<?php endif; ?>
</main>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

View file

@ -132,6 +132,10 @@ article.maintext {
padding-bottom: $lineheight;
}
.wp-block-image {
text-align:center;
}
/* 2.3 - Titles */
@mixin newTitle($font, $size, $weight) {
@ -325,3 +329,7 @@ th {
&-info { @include table-color($color-info); }
&-success { @include table-color($color-success); }
}
.text-maj {
text-transform: capitalize;
}

View file

@ -138,8 +138,9 @@ $preview-height: 8*$lineheight;
text-align:center;
margin:auto;
padding:auto;
display: block;
display: flex;
width:100%;
height: $preview-height;
}
}
}

View file

@ -388,6 +388,9 @@ ul, ol {
article.maintext {
padding-bottom: 1.5rem; }
.wp-block-image {
text-align: center; }
/* 2.3 - Titles */
h1, h2, h3, h4, h5, h6, h7 {
font-family: Open Sans, sans-serif;
@ -585,6 +588,9 @@ th {
.table-success th {
color: #859900; }
.text-maj {
text-transform: capitalize; }
/* --- 03. GLOBAL STYLING --- */
/*
* Les styles "globaux" touchant toute la page.
@ -1874,8 +1880,9 @@ ul.breadcrumb, ol.breadcrumb, .breadcrumb {
text-align: center;
margin: auto;
padding: auto;
display: block;
width: 100%; }
display: flex;
width: 100%;
height: 12rem; }
.preview-metadata {
color: #fdf6e3;