WordPress.org

Ready to get started?Download WordPress

Forums

Chocotheme - Adding Year to Date Displayed (4 posts)

  1. dripool
    Member
    Posted 3 years ago #

    Is it possible to add the year into the date displayed on Chocotheme for each post?

    I've spent hours trying to figure this out without any luck...
    Thanks

  2. K-Fella
    Member
    Posted 3 years ago #

    You need to edit the template file(s) for the theme. It probably uses the_time() instead of the_date().

  3. Daedalon
    Member
    Posted 2 years ago #

    Photog has a year on its dates on the left side of the posts. The code for this is very straightforward and might be easy to apply to ChocoTheme.

  4. Daedalon
    Member
    Posted 2 years ago #

    I did the straightforward steps and wanted to share them with you:

    1. Find the following starting in the theme's archive.php line 27, index.php line 8, search.php line 11 and single.php line 7:

    <span class="day"><?php the_time('d') ?></span>
    <span><?php the_time('M') ?></span>

    and add this line right after them:

    <span class="year"><?php the_time('Y') ?></span>

    2. Find this in the theme's style.css line 96:

    .post .date span { display: block; font-size: 16px; font-weight: bold; color: #f4b995; line-height: 1; text-transform: uppercase; }
    .post .date span.day { font-size: 26px; }

    and add this line right after:

    .post .date span.year { font-size: 8px; }

    To change the size of the year, change the number in font-size. If you want to make the year much bigger than this, you may need to decrease the sizes on two lines above so they won't hit the edges of the box.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags