Viewing 5 replies - 1 through 5 (of 5 total)
  • thats not outside the loop.

    see the differences between the_time and the_date in the codex:

    http://codex.wordpress.org/Template_Tags/the_date

    SPECIAL NOTE: When there are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the first post (that is, the first instance of the_date()). To repeat the date for posts published under the same day, you should use the Template Tag the_time() with a date-specific format string.

    http://codex.wordpress.org/Template_Tags/the_time

    Thread Starter Stunt

    (@stunt)

    Ah, okay. So I’m using this code:

    <div class=”date_header”><?php $my_date = the_date(”, ”, ”, FALSE); echo $my_date; ?></div>

    However, in my date_header style it contains these properties:

    ‘ background: #COLOR;
    color: #COLOR;
    border-bottom: 2px solid #COLOR;
    padding: 3px;
    margin-bottom: 5px;

    So even when there’s no date to display, it still shows an empty box. How would I make it so the empty box does not show?

    Thread Starter Stunt

    (@stunt)

    Ah, nevermind. I’m dumb, I got it.

    <?php $my_date = the_date('', '<div class="date_header">', '</div>', FALSE); echo $my_date; ?>

    display date outside the loop using wordpress defined language:

    $my_date = date(‘Y-m-d H:i:s’); // format in which date/time is stored in the wp database
    echo mysql2date(‘l, j. F, Y’, $my_date);

    Thread Starter Stunt

    (@stunt)

    Hey guys.

    I’d like to know, is there anyway to have this display, but not have it show up on the current day? Only for days that aren’t today?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Date Outside the Loop?’ is closed to new replies.