Forums

[resolved] How to set the text "Last Modified" in front of the date? [Last-Modified plugin] (3 posts)

  1. wigstroem
    Member
    Posted 11 months ago #

    Im from Sweden and my english sucks, but I do my best. :)

    I use the "Last-Modified" plugin to display the date for Last modified posts and I wonder how to set the text "Last Modified" in front of the date in the php-file, so it Display for example: "Last Modified: december 1, 2008 01:58".

    I use this code <?php mdv_last_modified(''); ?> to display the modified date in the posts. Can i write "Last Modified" in there? Someone know how to do that?

  2. LenK
    Member
    Posted 11 months ago #

    I'm not familiar with this plugin but you can hardcode this in your theme. I mention this for 2 reasons:

    1. Perhaps you can compare the code below to that of the plugin to get an idea
    2. For anyone else who might want to do this without a plugin

    The tag that outputs the date and time is <?php the_time() ?> and there are various arguments that can be used within the () In your theme you may have for instance Posted on <?php the_time('F jS, Y') ?> Modify it to read,

    Posted on <?php the_time('F jS, Y') ?>
    <?php $u_time = get_the_time('U');
    $u_modified_time = get_the_modified_time('U');
    if ($u_modified_time != $u_time) {
    echo " and last modified on ";
    the_modified_time('F jS, Y');
    echo ". "; } ?>

    This will output "Posted on BLAH BLAH and last modified on BLAH BLAH"

  3. wigstroem
    Member
    Posted 11 months ago #

    Thanks for the help! Its working for me now.

Reply

You must log in to post.

About this Topic