WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] remove time stamp only, keep date (5 posts)

  1. Trailmix
    Member
    Posted 1 year ago #

    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.

  2. channeleaton
    Member
    Posted 1 year ago #

    That's a weird use of the <abbr> tag. Anywho...

    Remove the following 2 items:

    Y-m-d\T

    and

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

  3. Trailmix
    Member
    Posted 1 year ago #

    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?

  4. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    try:

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

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

  5. Trailmix
    Member
    Posted 1 year ago #

    Thanks alchymyth - that's just what I needed. Works great.

Topic Closed

This topic has been closed to new replies.

About this Topic