Display year in post date

  • Anonymous

    #130

    Excellent theme. Easy to manipulate. Thanks. Although I am trying to figure out how to have the year of a post displayed in the date.

    http://www.hardestycapital.com/wordpress/

    Anything you can do to help would be great.

    Admin

    Syahir Hakim

    #11323

    Using a child theme, you can use the graphene_post_date action hook to hook your own function to display the date, and then hide the default date using CSS.

    ggci

    #11324

    Hi Syahir ~ just created a child theme and want to add the year into the date, too. Don’t quite understand how to do what you said to do, though. Could you provide a bit more detail please?

    ggci

    #11325

    can you provide a bit more detail about how to do this, please? thanks.

    Admin

    Syahir Hakim

    #11326

    I think the easier way to this is this way:

    1. Go to Graphene Display options page, and check Hide post date.

    2. Using a child theme’s functions.php file, create a function that will display the full post date including the year.

    3. Hook the above function to the graphene_post_meta action hook.

    4. Position the date using CSS.

    The function to create in the functions.php and the hook should look something like this:

    function graphene_custom_post_date(){ ?>
    <div class="custom_date"><?php the_time(get_option('date_format')); ?></div>
    <?php
    }
    add_action('graphene_post_meta', 'graphene_custom_post_date');

    Don’t forget to position and style the custom date using CSS.

    zampai

    #11327

    Simplier way :

    In loop.php find

    <p class="default_date"><?php the_time('M'); ?><br /><span><?php the_time('d') ?></span></p>

    And replace “M” by “Y” and “d” by “m”.

    So, graphene will displays “year + month” instead of “Month + day”.

    Thanks for the great theme.

    Admin

    Syahir Hakim

    #11328

    Zampai,

    The method you outlined is of course, easier, but is not recommended. This is because it involves editing the theme’s core files directly, which will cause you to lose the modification the next time you update the theme.

    zampai

    #11329

    Thanks for this advise

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.