From f92bdca3daed319217dd37af1ff12315ddd80490 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 20 May 2023 14:48:22 +0200 Subject: [PATCH] feat: better preview Fixes #48 --- components/article.php | 7 ++++++- components/preview-list.php | 11 ++++++++++- functions/reading-time.php | 15 +++++++++++++++ scss/components/_previews.scss | 8 +++++++- style.css | 6 +++++- 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/components/article.php b/components/article.php index 32a6bbc..f296af1 100644 --- a/components/article.php +++ b/components/article.php @@ -5,7 +5,12 @@

-

+ + category_parent; + if ( get_term( $category_parent_id, 'category' )->slug != "3-gallerie" ) {?> +

+

diff --git a/components/preview-list.php b/components/preview-list.php index 9104106..63e0d24 100644 --- a/components/preview-list.php +++ b/components/preview-list.php @@ -29,7 +29,16 @@ ?>
-
+
+ category_parent; + if ( get_term( $category_parent_id, 'category' )->slug != "3-gallerie" ) { + echo reading_time(); + } else { + echo image_number(); + } + ?> +
diff --git a/functions/reading-time.php b/functions/reading-time.php index 5a4ca24..bf0ae1a 100644 --- a/functions/reading-time.php +++ b/functions/reading-time.php @@ -20,4 +20,19 @@ function reading_time() { return $totalreadingtime; } +function image_number() { + $content = get_post_field( 'post_content', $post->ID ); + $count = substr_count( $content, ' \ No newline at end of file diff --git a/scss/components/_previews.scss b/scss/components/_previews.scss index 04ae0d6..547d976 100644 --- a/scss/components/_previews.scss +++ b/scss/components/_previews.scss @@ -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; diff --git a/style.css b/style.css index a6d037d..1cbc2a3 100644 --- a/style.css +++ b/style.css @@ -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;