How to remove date in pages without hurting posts

Latest Reply from Zanshin13 at 2013-10-01 15:48:37 Solution
I want to disable date on my pages (not posts) in SuperCars theme

I modified
<span class='post-date'><?php echo get_the_date(); ?></span>&nbsp
to that:
<span class='post-date'><?php if(is_single()){ echo get_the_date();} ?></span>&nbsp


But it stop showing the dates of post in main post list. But when i open some post the date appears. The pages meanwhile don`t show dates now. But i need my posts to show dates everywhere, so what I did wrong ? And how to do it right ?
Hi!
You can replace it with:
<span class='post-date'><?php if((is_single())|!(is_single())){ echo get_the_date();} ?></span>&nbsp
Hello , Alice!

First of all thanks for fast response.
I am not really pro , but i guess that
<b>|!</b>
was a misprint in your post, right ?
Anyway , your code doesn`t work , and I think it is because you meant
 if((is_single())<b>||!(IS_PAGE()))</b>
because otherwise it would always get the same "if" result(show date).


So, for showing dates in posts but not in pages you should add this
<span class='post-date'><?php if((is_single())||!(is_page())){ echo get_the_date();} ?></span>&nbsp
in theloop.php file. Problem solved.

But I would be very grateful if someone explains me why is_single() alone does not work
argh , I tried to highlight the code with bold html-tags.

Leave a reply

Add codeAdd image