Aug
22

The Family Tree posts date reworked

During the design of one client site, based on Bueno by Woo Themes but ported on Genesis (more on this later), I’ve faced the problem on how show the date like in the original.

The amazing Family Tree theme from Chris Ford of Creativity Included shows something very similar; her approach involves a series of images for the day/month part of the date and this, in a localized theme, leads to some issues on how to show the correct names for the months.

Here’s is what I’ve done to use just php to get rid of this issue:

note: The code below is useless if you cannot confront it with the original theme functions.php file.

remove_action('genesis_before_post_content', 'genesis_post_info');
add_action('genesis_before_post_content', 'tg_post_info');
function tg_post_info() {
if(is_page()) return; // don't do post-info on pages
echo '<div class="post-date-wrap">';
echo '<span class="day">';
echo the_time('j');
echo '</span>';
echo '<span class="month">';
echo the_time('M');
echo '</span>';
echo '</div>';
[continue as the original code]
}

As for the style:

SPAN.month
{
 display: block;
 font-size: 12px;
 text-transform: uppercase;
 font-weight: bold;
 text-align: center;
}
SPAN.day
{
 display: block;
 font-size: 36px;
 line-height: 32px;
 text-align: center;
}

The result:

Comments

  1. darcy says:

    So is the result here that you only make 12 pngs for the months, and 31 pngs for the dates?

    How do you handle the folders? currently, looking via FTP, it’s:

    images/dates/month/day

    do you then make png months in /month and numbers only in /day?

    Grazie!

  2. Marcela says:

    Hi Marco!

    I followed your instructions and this is what I got: http://www.carinhadeboneca.com.br/wp-content/uploads/2012/01/imagem.jpg

    No year information and two .pngs flags.

    Could you save me? =)

    Baci
    Marcela

    • Marco says:

      Hello, there is no code for the Year in my snippet.
      Check your functions.php because it looks like you have the add_action('genesis_before_post_content', 'tg_post_info'); action called twice in your functions.php, and you had not removed the Genesis post-info via the remove_action('genesis_before_post_content', 'genesis_post_info'); code.

  3. Marcela says:

    Gotcha!! It Finally works! Thanks!

Comment Policy: Your words are your own, so be nice and helpful if you can. Please, only use your real name and limit the amount of links submitted in your comment. I accept clean XHTML in comments, but don't overdo it please.

Leave a Comment

*

Hire Me