I’m not Anraiki but I think I can answer you with my little knowledge about PHP.
I may wrote something wrong so you should copy all of your code in “kommiku.php” file before edit it ??
Connect to your website through FTP. Open your plugins Folder and select Kommiku. You’ll see the “kommiku.php” file. Download and Open it with Text Editor programs (like Notepad, EditPlus etc.) and add this function on the top of all code.
function plural($num) {
if ($num != 1)
return "s";
}
function getRelativeTime($date) {
$diff = time() - $date;
$diff = round($diff/86400);
if ($diff<7) {
if($diff!=0) {
return $diff . " day" . plural($diff) . " ago"; }
else {
return "Today";
}
}
else {
return date('M jS,Y',$date);
}
}
Then find (It should be in 1039th line or around that).
if($chapter_list)
foreach ($chapter_list as $row) {
And look at $date line, Change ‘m/d’ to ‘U’ So it should be like this.
$date = date( 'U', strtotime($row->date) );
Press Enter to make new line and add this code
$showdate = getRelativeTime($date);
Lastly, Change “$date” to “$showdate” in the following line.
$kommiku['chapter_list'] .= '<li><small>['.$showdate.']</small> <a ...(blablabla)
That’s all. Your code should be like this now.
if($chapter_list)
foreach ($chapter_list as $row) {
$date = date( 'U', strtotime($row->date) );
$showdate = getRelativeTime($date);
$kommiku['chapter_list'] .= '<li><small>['.$showdate.']</small>
...(and blablabla)
and on the top off all code should have that function.
This code will show “Today”. If the time you uploaded the chapter is on today. And It will show …days ago if it’s not today. But If it’s more than 6 days ago it will show mm-dd-yy like you want.
If you don’t want to let it show …days ago. I mean, If you just want to check that it’s today or not. So you have to use this code as the function instead.
function plural($num) {
if ($num != 1)
return "s";
}
function getRelativeTime($date) {
$diff = time() - $date;
$diff = round($diff/86400);
if ($diff==0) {
return "Today";
}
else {
return date('M jS,Y',$date);
}
}
I hope this can help you =). I’m not a good english speaker so sorry for my bad grammar.
PS.The getRelativeTime function. I edited from the function here