feat: better preview

Fixes #48
This commit is contained in:
Kazhnuz Klappsthul 2023-05-20 14:48:22 +02:00
parent 3fcc5dfedf
commit f92bdca3da
5 changed files with 43 additions and 4 deletions

View File

@ -5,7 +5,12 @@
<article class="article container-article" id="post-<?php the_ID(); ?>">
<?php if ($haveTitle) { ?>
<h1 class="page-title"><?php the_title(); ?></h1>
<p class="align-right"><span class="btn-small btn-secondary"> <?php echo reading_time(); ?> </span></p>
<?php $category = get_the_category();
$category_parent_id = $category[0]->category_parent;
if ( get_term( $category_parent_id, 'category' )->slug != "3-gallerie" ) {?>
<p class="align-right pr-half"><span class="btn-small btn-secondary"> <?php echo reading_time(); ?> </span></p>
<?php }?>
<?php } else { ?>
<h1 class="sr-only"><?php the_title(); ?></h1>
<?php } ?>

View File

@ -29,7 +29,16 @@
?></div>
<div><time><span class="btn-small btn-info small-text"><?php the_time('d/m/Y') ?></span></time></div>
</div>
<div class="comment-text"><?php comments_number('Pas de commentaire', 'Un commentaire', '% commentaires' );?></div>
<div class="comment-text">
<?php $category = get_the_category();
$category_parent_id = $category[0]->category_parent;
if ( get_term( $category_parent_id, 'category' )->slug != "3-gallerie" ) {
echo reading_time();
} else {
echo image_number();
}
?>
</div>
</div>
</div>
</div>

View File

@ -20,4 +20,19 @@ function reading_time() {
return $totalreadingtime;
}
function image_number() {
$content = get_post_field( 'post_content', $post->ID );
$count = substr_count( $content, '<img' );
if ($count == 1) {
$timer = " image";
} else {
$timer = " images";
}
$imagenumber = $count . $timer;
return $imagenumber;
}
?>

View File

@ -89,7 +89,7 @@ $comment-peek-height:0px;
line-height: $lineheight !important;
text-align:justify;
background-color:rgba(0,0,0,0.00);
color:dim(getFontColor());
color: transparentize($color-font, 0.3);
position: relative;
overflow:hidden;
@ -147,6 +147,12 @@ $comment-peek-height:0px;
width:100%;
margin:auto;
&:not(.p-img) {
position:absolute;
top:3rem;
padding:0.5rem;
}
& > img {
max-width:100%;
height:auto;

View File

@ -2794,7 +2794,7 @@ ul.social {
line-height: 1.6rem !important;
text-align: justify;
background-color: rgba(0, 0, 0, 0);
color: rgba(7, 54, 66, 0.4);
color: rgba(7, 54, 66, 0.7);
position: relative;
overflow: hidden; }
.preview-content .preview-overlay {
@ -2836,6 +2836,10 @@ ul.social {
.preview-exerpt > p {
width: 100%;
margin: auto; }
.preview-exerpt > p:not(.p-img) {
position: absolute;
top: 3rem;
padding: 0.5rem; }
.preview-exerpt > p > img {
max-width: 100%;
height: auto;