Hiding date for entries not shown on front page?
Hiding date for entries not shown on front page?
Good evening!
I have a couple of entries that I've hidden from the front page, containing links and a gallery and such (I don't want to use static pages, I still want the comments).
My question is whether it'd be possible to hide the date for these entries? Perhaps in the same way the 'sticky'-text is not shown when the entry isn't stickied?
I don't know much of the smarty syntax, so I won't solve this one myself.
Thanks much!
I have a couple of entries that I've hidden from the front page, containing links and a gallery and such (I don't want to use static pages, I still want the comments).
My question is whether it'd be possible to hide the date for these entries? Perhaps in the same way the 'sticky'-text is not shown when the entry isn't stickied?
I don't know much of the smarty syntax, so I won't solve this one myself.
Thanks much!
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Hiding date for entries not shown on front page?
Hi!
It depends a bit on your template. If you use a template that shows the date for each entry again and again, and not only once for all entries of the same day, you can easily create a custom field called something like "hide_date" and then set that to "1" or "true" for every entry that should get no date. Then inside your entries.tpl you would just make an "{if $entry.properties.ep_hide_date != ''}" smarty check around the output of your date.
If the date is emitted not for entries themselves, but rather for dategroups, this won't work. You must then change the template and shuffle the foreach-loops where the date is printed within the main loop, resulting in slightly more work.
HTH,
Garvin
It depends a bit on your template. If you use a template that shows the date for each entry again and again, and not only once for all entries of the same day, you can easily create a custom field called something like "hide_date" and then set that to "1" or "true" for every entry that should get no date. Then inside your entries.tpl you would just make an "{if $entry.properties.ep_hide_date != ''}" smarty check around the output of your date.
If the date is emitted not for entries themselves, but rather for dategroups, this won't work. You must then change the template and shuffle the foreach-loops where the date is printed within the main loop, resulting in slightly more work.
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi Don!
Well, if the no-frontpage option is set, the entry doesn't even show up on the frontpage...I was reading the question like it was about the frontpage, not the entry detail page?
Of course if it's all only about the entry detail page, then one should use this variable, you are right!
Regards,
Garvin
Well, if the no-frontpage option is set, the entry doesn't even show up on the frontpage...I was reading the question like it was about the frontpage, not the entry detail page?
Of course if it's all only about the entry detail page, then one should use this variable, you are right!
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Yeah, actually I added 'true' to the code and wrote true in the field to make it happen.Don Chambers wrote:Hey Garvin - how about {if $entry.properties.ep_no_frontpage ='true'}?? Then the date hiding would correspond exactly to the flag already set for hiding the entry from the frontpage, and an additional custom extended property field would not be necessary....
Edit: I read your answer too fast, I'm a little tired. If what you say means I don't have to type anything extra (they won't be on the front page, ever) that'd be great!
Actually, I changed it toand now I get a fatal error.
Code: Select all
{if $entry.properties.ep_no_frontpage ='true'}
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Sorry, that should be 2 equal signs....
Code: Select all
{if $entry.properties.ep_no_frontpage =='true'}
=Don=
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
I didn't look at more than a single entry... looks like $entry.properties.ep_no_frontpage does not exist at all for entries that are not hidden, so the first instance of it occuring sets it to true, and it never gets set to anything else.
This MIGHT work:
Then again, if you already have a solution, there is probably no reason to change it except for curiosity. My point was simply to use the same ep field that already exists rather than creating a new one... that way, your single check of "hide from frontpage" solves both of your objectives.
This MIGHT work:
Code: Select all
{if $entry.properties.ep_no_frontpage}
=Don=
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact: