[wp-hackers] Displaying date on archive pages
RePost
repost_08 at yahoo.com
Fri Dec 26 17:53:26 GMT 2008
Harish Narayanan wrote:
> RePost wrote:
>
>
>> Does WordPress provide a tag that will let me display the date on top of
>> my archives pages?
>>
>> I'd like to display "Archive: December 26, 2008" or "Archive: December
>> 2008," where the tag would provide the date.
>>
>
> There might be a simpler (as in more modern) way, but I use a
> combination of is_{something}() followed by a suitable call to
> the_time() to set my title.
>
> For e.g.,
>
>
> <?php /* If this is a daily archive */ } if (is_day()) { ?>
> <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
>
> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
> <h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
>
> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
> <h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
>
Thanks, Harish.
This returns an "unexpected '}' error" for the first line.
Wish I could do more with php than write includes. Do you see an error here?
More information about the wp-hackers
mailing list