views:

60

answers:

3

Hi,

I'm setting up a Wordress installation where I want some of the articles to show the date they were posted, and other articles to leave the date out. I'd like these articles to be completely dateless, if possible, so they only show in category archives and not in date archives.

I'm guessing I can tweak the templates to show the date or not based on the article's category, I was wondering if there was an easier solution to this?

Or should I start writing my own plugin to do this?

I've not got anything online at the moment, this is just an idea I'm churning over in my head for now.

Cheers,

Dan

+1  A: 

Your theory of how to do it (have the theme files make a check for the category, then either display the date or not) is correct.

I think this code should do it:

<?php
if (is_category('CategoryThatDisplaysDates')) {
echo '<p>Date posted: '; the_date(); echo '</p>';
};
?>
ahockley
Thanks, thought that would be the best way to do it. Means checking all the archive templates as well to only show the dated articles in the date archive... still, no-one ever said site design would be easy!
Dan
+1  A: 
Florian Jenn
A: 

i'd go with a custom field. you can read about using custom fields here: http://codex.wordpress.org/Using%5FCustom%5FFields

Zoran Zaric