Ready to get started?Download WordPress


[resolved] align today's date on right margin (5 posts)

  1. befree22
    Posted 2 years ago #

    Could someone help me align the date to the right margin of site

    I added the php code for today's date to the header.php file: http://pastebin.com/7AEQaFNS

    I added this code to the .css file: http://pastebin.com/gb5hnkya

    What am I doing wrong?

  2. the_time() does show the publish time of a post;
    outside the loop, this could be random, possibly the last or first post on the page.


    consider to use date() instead; http://php.net/manual/en/function.date.php

    as for the formatting, you are confusing css ids and classes;

  3. befree22
    Posted 2 years ago #

    OK, I used this code for the date: <?php echo date('l jS, F, Y') ?>

    For the css, I added this code but the date isn't aligning to the right of the blog page:
    `.todaysdate {
    float: right;
    color: #444;
    font-size: 20px;
    line-height: 1.625em;
    padding: 0 1.2125em;
    margin-top: 10px;
    font-weight: bold;

    It works when I use .todaysdate but not when I use #todaysdate. Thanks :)

    I'm using a 2012 child theme on the site.

  4. WPyogi
    Forum Moderator
    Posted 2 years ago #

    You need to use .todaysdate (period for class, hashtags are for id)

  5. befree22
    Posted 2 years ago #

    It works! Now I know the difference between period for class, hashtags are for id.

Topic Closed

This topic has been closed to new replies.

About this Topic