Support » Fixing WordPress » Stylish current date

  • I want to get the current date and actually I use

    <?php echo date_i18n('j F Y', time()); ?>
    with a class: <span class="current-date"><?php echo date_i18n('j F Y', time()); ?></span>

    The thing is I want to show it with a background marker and the day bigger than the month. Any idea on how to style it?

    Kind Regards,
    Yolanda.

Viewing 5 replies - 1 through 5 (of 5 total)
  • break it into three ‘dates’ ?

    <span class="current-date"><span class="current-day"><?php echo date_i18n('j', time()); ?></span><span class="current-month"><?php echo date_i18n('F', time()); ?></span><span class="current-year"><?php echo date_i18n('Y', time()); ?></span></span>
    catacaustic

    (@catacaustic)

    very awesome

    You’d need to break the date into seperate parts and wrap the parts in new tags that you can style. Something like…

    <span class="current-date">
        <span class="current-date-day"><?php echo date_i18n('j', time()); ?></span>
        <span class="current-date-month"><?php echo date_i18n('F', time()); ?></span>
        <span class="current-date-year"><?php echo date_i18n('Y', time()); ?></span>
    </span>

    Yes! worked!
    and to show the day of the week (name)?I have this for the moment:
    the date with a red marker background: http://diariomenu.com/
    and would need to show the day of the week (monday,etc) and if possible to show the entire background marker over the content, is it a z-index class?

    Kind Regards,
    Yolanda.

    catacaustic

    (@catacaustic)

    very awesome

    You can find the different formats that are available by looking at PHP’s manual page for date(). There’s a huge amount of options there so I’m sure that you’ll find what you want.

    I’m not 100% sure on what you want to do with the background but it sounds like it’s a styling issue. A bit of CSS should be able to get what you want.

    Thanks catacaustic for the answer to my problem.
    Awesome it worked like a charm!

    Kind Regards,
    Yolanda.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Stylish current date’ is closed to new replies.