WordPress.org

Ready to get started?Download WordPress

Forums

Possible to use the_date twice in one loop? (4 posts)

  1. JPigford
    Member
    Posted 8 years ago #

    I need to assign different CSS classes to different parts of the date but can't figure out how to sparate parts of the date. For instance, I deally I'd do like

    <?php the_date('M', '<h2 class="date-m">','</h2>'); ?>
    <?php the_date('d', '<h2 class="date-d">','</h2>'); ?>

    But it will only echo the first the_date.

    Any ideas on how to echo it twice?

  2. moshu
    Member
    Posted 8 years ago #

    Use the_time?
    (and read carefully the description of the_date :)
    http://codex.wordpress.org/Template_Tags/the_date

  3. MichaelH
    Member
    Posted 8 years ago #

    Template_Tags/the_date updated so that moshu's recommendation is more apparent!

  4. moshu
    Member
    Posted 8 years ago #

    Great, Michael!
    (though it won't help those that never go to read the Codex first, LOL)

Topic Closed

This topic has been closed to new replies.

About this Topic