Welcome to Help center

We are here to help

How to add the year to date in posts?

Follow

Replace these lines :

1. **** style.css *****

.blog_post .date_of_post {
   position:relative;
left:1px;
width:54px;
   height:62px;
   color:#fff;
   float:left;
   margin:0;
background: #F15A23;
}
.blog_post .date_of_post .day_post {
   font-size:20px;
   text-align:center;
   filter:none;
   float:left;
   width:100%;
   font-weight:bold;
   margin:2px 0 0 0
}
.blog_post .date_of_post .month_post {
   font-size:12px;
   text-align:center;
   float:left;
   width:100%;
   text-transform:uppercase;
   line-height:18px;
position:relative;
top: -6px;
}
.blog_post .date_of_post .year_post {
   font-size:12px;
   text-align:center;
   filter:none;
   float:left;
   width:100%;
   font-weight:bold;
   line-height:10px;
position:relative;
top: -6px;
}

 

2. ***** content.php *****

<article id="post-<?php the_ID(); ?>" <?php post_class('blog_post'); ?>>
<?php $day = get_the_date('d');
 $month_abr = get_the_date('M');
 $year_full = get_the_date('Y');
?>
<?php if (get_the_title() == '') : ?>
<a href="<?php the_permalink(); ?>" rel="bookmark">
<?php endif; ?>

<div class="date_of_post updated">
<span class="day_post"><?php print $day; ?></span>
<span class="month_post"><?php print $month_abr; ?></span>
<span class="year_post"><?php print $year_full; ?></span>
</div>

 

Comments

Top
Powered by Zendesk