Support » Themes and Templates » remove time stamp only, keep date

  • Resolved Trailmix

    (@trailmix)


    I want to remove just the time stamp and leave the date. I checked the codex but mine looks more complicated and I’m getting errors with everything I’ve tried. So what parts do I need to delete from this code?
    <div class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO') ?>"><?php unset($previousday); printf( __( '%1$s – %2$s', 'sandbox' ), the_date( '', '', '', false ), get_the_time() ) ?></abbr></div>
    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • That’s a weird use of the <abbr> tag. Anywho…

    Remove the following 2 items:

    Y-m-d\T

    and

    the_date('', '', '', false),

    I get an error:

    Warning: printf() [function.printf]: Too few arguments in [my url] on line 19

    But it seems like that suggestion would remove the date and I’m trying to keep the date and remove the time only. Anyway I decided to just copy the simple code from the codex:

    <div class="entry-date"><?php the_time('l, F jS, Y') ?></div>

    And it works! Although I don’t really know what the rest of the code was that I deleted… do you see anything I should have left in there?

    try:

    <div class="entry-date"><?php unset($previousday); printf( __( '%1$s', 'sandbox' ), the_date( '', '', '', false )) ?></div>

    http://php.net/manual/en/function.printf.php

    Thanks alchymyth – that’s just what I needed. Works great.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘remove time stamp only, keep date’ is closed to new replies.