WordPress.org

Ready to get started?Download WordPress

Forums

How-To add Twenty Eleven Post Date Images (3 posts)

  1. Digital Raindrops
    Member
    Posted 2 years ago #

    Hi people,
    Another user here asked about adding a date image to a theme, I looked at a couple of examples and thought it would make a great twenty eleven child theme post.

    So I have created a downloadable child theme for twenty eleven that has a date icon, although I have posted it as date image, the icon is pure css no images, so the gradient color can be changed easy.

    I hope it is of use to someone.
    Twenty Eleven Post Date Image

    HTH

    David

  2. superciccio14
    Member
    Posted 1 year ago #

    Thanks!

    Ok, I followed that tutorial. I have 2 questions:

    A. why the date displayed is always "Jan 01"?

    B. Once fixed point A, how can I change date format from English to Italian?

  3. superciccio14
    Member
    Posted 1 year ago #

    OK for point B I modified functions.php as follows

    if ( ! function_exists( 'raindrops_posted_date' ) ) :
    function raindrops_posted_date() {
    ?>
    <h2 class="title-date"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <?php
    global $post;
    $day = date( 'd',strtotime( esc_html( get_the_date() ) ) );
    $month = date( 'M',strtotime( esc_html( get_the_date() )) );
    
    		switch ($month) {
    		    case 'Jan':
    		        $month = 'Gen';
    		        break;
                    /* and so on ... */
    		}
    
    ?>
    <div class="post-date">
    <span class="post-month"><?php echo $month; ?></span>
    <span class="post-day"><?php echo $day; ?></span>
    </div>
    <?php
    }
    endif;

    but I can't understand why every post is tagged by January, 1st...

Topic Closed

This topic has been closed to new replies.

About this Topic