WordPress.org

Forums

[resolved] Pass the_time() to a variable? (4 posts)

  1. black-dog
    Member
    Posted 7 years ago #

    Is there a way to pass the_time() to a variable, like it is with the_date()?

  2. skulled
    Member
    Posted 7 years ago #

    the_time doesn't work that way, but try sending in a the_date call with time specific formatting ..

  3. black-dog
    Member
    Posted 7 years ago #

    I tried with the_date() first, but it only shows once if a day has more than one posts. The trick is to use get_the_time(). Sorry for not searching more carefully before posting.

  4. Ptryk
    Member
    Posted 7 years ago #

    its unclear to me if you figured out your issue or not, but to use the_date like a variable you need to set one of the arguments to false so it won't send it to the screen.. see here:
    http://codex.wordpress.org/Template_Tags/the_date

    I needed to do it once and used something like:
    <?php $current_date = the_date('', '', '', FALSE);?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.