Support Forum
Hi,
Your function- sp_nicedate() is nice.
It show something like:
2 days ago.
It is build in the sp-api-timezone.php
of course I can change this template but with the first update it will be gone...
I made a separate Theme which there I can do changes without being afraid from updates.
In my language i need the string: "2 days ago" written this way:
"ago 2 days".
Is there a way to do it in my theme?
Now that is a real good question and the answer is no. But it can quite easily be yes i think.
Let me have a quick play but I propose that we can add a filter to the code that you can then easily use to change the display characteristics. And we should be able to do that right away.
I ill get back to you after I work it out...
YELLOW
SWORDFISH
|
OK - what I can do is give you the edits to make to the current code. I will then make sure that the filter gets included in the sp_nicedate() function in the very next update so things will continue to work afterwards.
So - first change is to the sp_nicedate() function in the sp-api-timezone.php file as follows:
Change:
} else { return "$difference $periods[$j] {$tense}"; }
at the end of the function... to:
} else { $nd = "$difference $periods[$j] {$tense}"; return apply_filters('sph_nicedate', $nd, $difference, $periods[$j], $tense); }
and then add the following filter function to your spFunctions.php file - found in the /templates folder of the Simple:Press theme you are using.
add_filter('sph_nicedate', 'my_nicedate', 1, 4); function my_nicedate($nd, $difference, $period, $tense) { return $tense.' '.$difference.' '.$period; }
and that should give you what you are after I believe.
YELLOW
SWORDFISH
|
1 Guest(s)