How do I add the year to posts?

Discussion in 'ToomMorel WordPress Theme' started by espycameras, Jun 23, 2015.

Thread Status:
Not open for further replies.
  1. espycameras

    espycameras New Member

    Joined:
    Dec 28, 2011
    Messages:
    25
    Likes Received:
    1
    The posts show the month and date but not the year.
     
  2. praveen

    praveen Support Staff

    Joined:
    Jan 1, 2015
    Messages:
    2,344
    Likes Received:
    67
    Hello,

    Please follow the screenshot given below.
    ToomMorel_add_year_in_blog_posts.png
    PHP:
    <span class="year"><?php echo get_the_time('Y'?></span>
    Now, paste the code given below in Custom CSS section
    (Appearance -> Theme Options -> Styling Options -> Custom CSS) of your dashboard.
    Code:
    span.year {
      margin-left: 6px;
      font-size: 14px;
    }

    Thanks,
    Praveen
     
  3. espycameras

    espycameras New Member

    Joined:
    Dec 28, 2011
    Messages:
    25
    Likes Received:
    1
    Ok - Got it - I inserted the code into the single post php.

    Thanks
     
  4. espycameras

    espycameras New Member

    Joined:
    Dec 28, 2011
    Messages:
    25
    Likes Received:
    1
    When I inserted the Year into the single post, the year runs into any post title that has more than 1 line. I would like to move the day-month-year above the post title to avoid that problem. See attached image.
    Thanks!
     

    Attached Files:

  5. praveen

    praveen Support Staff

    Joined:
    Jan 1, 2015
    Messages:
    2,344
    Likes Received:
    67
    Hello,

    Please follow the screenshot given below.
    toommorel_shift_date_above_post_title.png

    PHP:
    <div class="post blog <?php post_class(); ?>" id="post-<?php the_ID(); ?>">
          <div class="post-date"><span class="day">
              <?php the_time('d'); ?>
              <span class="month"><?php echo get_the_time('M'?><span class="year"><?php echo get_the_time('Y'?></span></span></span>
          </div>
        <h1 class="post_title"><span class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
              <?php the_title(); ?>
              </a>
              </span>
        </h1>
    Now, paste the code given below in Custom CSS section
    (Appearance -> Theme Options -> Styling Options -> Custom CSS) of your dashboard.
    Code:
    .post-date span.day {
      color: #303030;
      font-size: 72px;
      line-height: 1;
      letter-spacing: -7px;
      float: left;
      width: 100px;
      font-weight: bold;
      position: relative;
      margin-top: -5px;
    }
    span.month {
      color: #303030;
      font-size: 10px;
      line-height: 1;
      text-transform: uppercase;
      letter-spacing: 0;
      position: absolute;
      bottom: 15px;
      left: 70px;
    }
    span.year {
      font-size: 14px;
      margin-left: 3px;
    }
    .post .post_title {
      margin-top: 75px;
      padding-bottom:0;
    }
    Thanks,
    Praveen
     
  6. espycameras

    espycameras New Member

    Joined:
    Dec 28, 2011
    Messages:
    25
    Likes Received:
    1
    Will this take care of the problem on the single post page as well?
     
  7. praveen

    praveen Support Staff

    Joined:
    Jan 1, 2015
    Messages:
    2,344
    Likes Received:
    67
    Hello,

    You will have to customize the theme source code for the single post pages also.
    Please send us your website WordPress login details at [email protected] along with the thread link.

    We will customize it for you :)

    Thanks,
    Praveen
     
  8. espycameras

    espycameras New Member

    Joined:
    Dec 28, 2011
    Messages:
    25
    Likes Received:
    1
    Sent requested information - Thanks!
     
  9. espycameras

    espycameras New Member

    Joined:
    Dec 28, 2011
    Messages:
    25
    Likes Received:
    1
    Brilliant! The date is perfect now.​
    Thank you for the great support that has always been there throughout the years. Always knowledgeable and always prompt!​
    Cheers,​
    Paul​
     
Thread Status:
Not open for further replies.

Share This Page