Support » Themes and Templates » Display last modified date instead of publish date on posts

  • Ok so I have been looking through the internet for hours and cant seem to find a way to do this. Basically my posts display the date it was published on. I want that date to update and reflect the date it was last modified rather then the day it was published. I update my posts frequently but it seems the only want to change the date reflected on the post is by altering the publish date every time. Now i know that changing this may require altering the theme I am using which is fine I just cant seem to figure out how (i am using the suffusion theme). It looks like there are alot of site that give a code line like

    <?php the_modified_time('jS F Y') ?>

    but this looks like code that will just populate it. I want to change the fact that the publish date shows at all and only shows modified date. An example page that I am refering to can be found at http://www.ecigsavings.com/eluma-electronic-cigarettes/ which in that grey box in the top left thats where i want the last modified date to show.
    Can anyone help? I will put this in support cause i dont know if this actually is a theme or css thing or what not i just know i need support 🙂 lol

Viewing 12 replies - 1 through 12 (of 12 total)
  • Something like:

    <?php if( get_the_modified_date() != get_the_date() ) echo the_modified_date();?>

    should work.

    http://codex.wordpress.org/Template_Tags/the_modified_date
    http://codex.wordpress.org/Template_Tags/the_modified_time

    yeah but where do i put that in order to have my publish date reflect the modified date instead. Like if you go to that page i referenced above youll see a little box with the date in it at the top corner. I want to change that date to last modified date… what do i do and where do i go to do that?

    Try using it to replace <?php the_date();?> in your theme’s index.php template file.

    my themes index.php does not even have the word date in the entire file

    Try dropping a copy of that file into the WordPress pastebin and post the pastebin url here. Perhaps someone will be able to spot where the date is being pulled from.

    only thing i can find in my themes files is

    <div class="date"><span class="month"><?php the_time('M') ?></span> <span class="day"><?php the_time('d') ?></span><span class="year"><?php the_time('Y') ?></span></div>

    and have no idea where to look to see where is pulls its data or anyhting im so lost and been working on this for like 4 days now… I mean all i want is the stupid date to reflect the date that it was last saved thats it… i dont understand why this is so hard to do. This should be a standard setting in wordpress

    <iframe src=”http://pastebin.com/embed_iframe.php?i=EJ96USb1″ style=”border:none;width:100%”></iframe>

    dont know how to use WordPress pastebin above where where i tried to embed it ehre and obviously failed

    so noone knows how to do this with the suffusion theme? Its for sure not the index.php file. Suffusion does things very very differently. Can anyone possibly download the theme and look through the files for me? This is very very important to me and I tried asking on the support forum for the theme itself but not getting responses there either 🙁

    the theme can be downloaded at http://wordpress.org/extend/themes/suffusion

    Sorry I sounded frustrated yesterday I just been looking so long that its became a thorn in my back. If anyone can figure this out you will be my hero. And again an emample site with this theme is http://www.ecigsavings.com/totally-wicked-electronic-cigarette/
    Youll notice the little grey date box in the top left. Thanks again!

    In the code that you pasted out from Suffusion I guess you should be able to swap out calls to the_time with the_modified_time.

    If you’re going to try to modify the themes you’re using. I suggest working through the developer documents to get more used to the themeing system that wordpress uses. http://codex.wordpress.com/ is your friend.

    That said, this post looks to be fairly old but I thought I’d post more info in case other folks ran across it like I did and found the responses less than helpful.

    What you’re looking for in your theme templates are the specific code that generates the post display. This can often be in a few places:

    index.php
    posts.php
    single.php

    I recommend using a find command in linux or using an editor that can search all documents in the theme directory to locate the function in question. I use Dreamweaver, which does a really nice find over an entire site, but that’s not always available to everyone. Notepad++ should have some good find features but I don’t know how well it covers multiple documents, so you might have to do some hunting to find where the function your looking for is called.

    For the particular theme in question, the document you’re looking for is in suffusion\functions\actions.php. The the_time is called in several places throughout the document. I think that mostly where you’re looking to edit is in lines 1344 and 1379, but it’s called several other places in the script which may or may not point to that gray box you’re hoping to get updated.

    Once you’ve been able to find where it gets called, just replace it with the_modified_time and it should display as intended.

    Now, if you’re trying to sort your posts by the_modified_time instead of the_time, then I think you’re going to have to dig through the code to see where the loop is called. From skimming this particular theme, I’m sure it’s buried somewhere deep, but it looks like they hide a lot in functions.php and actions.php and probably a couple other places, so I’d search those first. I’d hit up the wordpress codex and read the various entries on the loop before messing with it too much.

    And remember, if you update your theme, all your changes will be lost, so either don’t update, or document the changes you made so that you can make them again.

    Davin,
    Thanks for the info. FYI this issue was bypassed through a feature added to the theme: http://aquoid.com/forum/viewtopic.php?f=4&t=1877&p=8375#p10132

    Sayontan.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Display last modified date instead of publish date on posts’ is closed to new replies.