How to remove date and duration of reading time on a sticky post ?

Post Reply
User avatar
jeronath
Sr. Bludit
Posts: 37
Joined: Tue Apr 26, 2022 11:54 am
Location: Paris
Has thanked: 3 times
Been thanked: 4 times
Contact:

Hello everybody,

As the title of my topic makes clear, I would like to remove the date and duration of reading on the sticky post that I made for my home page and I don't find anyway to do this.

Image

Home page of https://jeronath.net

Does anybody have an idea ?
Thanks a lot for your attention !

Nath
User avatar
novafacile
Master Bludit
Posts: 107
Joined: Sat Oct 06, 2018 4:47 pm
Has thanked: 35 times
Been thanked: 10 times
Contact:

This depends on the theme you use. Wich theme do you use?

The date and author are shown with
​​

Code: Select all

$​page​->​date​();

Code: Select all

$​page​->​author​([...]);
You have to remove this from the theme file of the static page.

Most themes uses the same theme file for static pages and blog pages. If your theme use the same file for both and you want to show date and author on blog pages, then you have to integrate an if/then/else of page type.
User avatar
jeronath
Sr. Bludit
Posts: 37
Joined: Tue Apr 26, 2022 11:54 am
Location: Paris
Has thanked: 3 times
Been thanked: 4 times
Contact:

Hello,

Thanks for your help !
I am not a skilled developer and don't know php...
I just use blogx with several plugins...

It is not a static page but a pinned one without title and under there are the posts.
Can you give me more precise indications ?

Thanks in advance.
User avatar
novafacile
Master Bludit
Posts: 107
Joined: Sat Oct 06, 2018 4:47 pm
Has thanked: 35 times
Been thanked: 10 times
Contact:

Oh I see I misunderstood your need a bit, you want to remove this only for sticky posts. You can do something like this:

Add this in the following file /bl-themes/blogx/php/home.php

Line 19

Code: Select all

if(!$page->sticky()){
Line 25

Code: Select all

}
This should removes it from every sticky post. Please test if it's works. Currently I can't test it, this is just an untested idea. Hope it helps.
User avatar
jeronath
Sr. Bludit
Posts: 37
Joined: Tue Apr 26, 2022 11:54 am
Location: Paris
Has thanked: 3 times
Been thanked: 4 times
Contact:

novafacile wrote: Wed May 11, 2022 11:15 pm
Line 19

Code: Select all

if(!$page->sticky()){
Line 25

Code: Select all

}
Thanks for your help !

I have tried but got a bad result : no more web site at all. So I go back to the previous version !
But I think it is because I don't understand where to put the code. Maybe your file is not exactly the same as mine...

Can you give me a sample of your solution by showing the right place in the code. Sorry for my incompetence !

Best regards.
Nath
User avatar
novafacile
Master Bludit
Posts: 107
Joined: Sat Oct 06, 2018 4:47 pm
Has thanked: 35 times
Been thanked: 10 times
Contact:

The idea is to replace this

Code: Select all

 
 ​        ​<!-- Creation date -->
 ​        ​<​h6​ ​class​="​card-subtitle mb-4 text-muted​"​>  
 ​            ​<​i​ ​class​="​bi bi-calendar​"​>​</​i​>​<?php​ ​echo​ ​$​page​->​date​(); ​?> 
 ​            ​<​i​ ​class​="​ms-3 bi bi-clock-history​"​>​</​i​>​<?php​ ​echo​ ​$​L​->​get​(​'Reading time'​) . ​': '​ . ​$​page​->​readingTime​(); ​?>  
 ​        ​</​h6​>
with this:

Code: Select all

if (!$page->sticky()){
 ​        ​<!-- Creation date -->
 ​        ​<​h6​ ​class​="​card-subtitle mb-4 text-muted​"​>  
 ​            ​<​i​ ​class​="​bi bi-calendar​"​>​</​i​>​<?php​ ​echo​ ​$​page​->​date​(); ​?> 
 ​            ​<​i​ ​class​="​ms-3 bi bi-clock-history​"​>​</​i​>​<?php​ ​echo​ ​$​L​->​get​(​'Reading time'​) . ​': '​ . ​$​page​->​readingTime​(); ​?>  
 ​        ​</​h6​>
}
But I am not 100% sure if this is completely correct. I can't test it right now because I'm traveling.
User avatar
novafacile
Master Bludit
Posts: 107
Joined: Sat Oct 06, 2018 4:47 pm
Has thanked: 35 times
Been thanked: 10 times
Contact:

Otherwise you can remove the whole code of this, but then it's never shown.
User avatar
jeronath
Sr. Bludit
Posts: 37
Joined: Tue Apr 26, 2022 11:54 am
Location: Paris
Has thanked: 3 times
Been thanked: 4 times
Contact:

novafacile wrote: Thu May 12, 2022 3:02 pm Otherwise you can remove the whole code of this, but then it's never shown.
Thanks a lot for your help !
Starting from your proposal and using a little logic by comparing other pieces of code in the page I made :

Code: Select all

<!-- Creation date -->
	<?php if (!$page->sticky()): ?>
	<h6 class="card-subtitle mb-3 text-muted"><?php echo $page->date(); ?> - <?php echo $L->get('Reading time') . ': ' . $page->readingTime(); ?></h6>
	<?php endif ?>
which replaces :

Code: Select all

<!-- Creation date -->
<h6 class="card-subtitle mb-3 text-muted"><?php echo $page->date(); ?> - <?php echo $L->get('Reading time') . ': ' . $page->readingTime(); ?></h6>
and the date and reading time no longer appear on the sticky pages !
Great !
Thanks !
User avatar
novafacile
Master Bludit
Posts: 107
Joined: Sat Oct 06, 2018 4:47 pm
Has thanked: 35 times
Been thanked: 10 times
Contact:

jeronath wrote: Fri May 13, 2022 5:10 pm Starting from your proposal and using a little logic by comparing other pieces of code in the page I made :

Code: Select all

<!-- Creation date -->
	<?php if (!$page->sticky()): ?>
	<h6 class="card-subtitle mb-3 text-muted"><?php echo $page->date(); ?> - <?php echo $L->get('Reading time') . ': ' . $page->readingTime(); ?></h6>
	<?php endif ?>
Ah of course, I forgot the html context... :geek: :oops:
Post Reply