I’m proud of this quicktag trick!
-
So yesterday we discussed how to prefix insertions to posts with the time the insertions were made, using CSS. We discovered this could be done by editing the
wp-layout.cssfile to use the:beforepseudo-element with theinstag:
ins:before {
content: attr(datetime);
}
The output of an update to a post such as “Hi Mom!” when betweeninstags would then look like this:
2004-7-26T10:47:47-4:00Hi Mom!
This is not the most easily readable format. So today I figured out how to change it. You need to edit thequicktags.jsfile, a JavaScript file. I made these edits:
Line 19:-
Original
var datetime = now.getFullYear() + '-' + now.getMonth() + '-' + now.getDate() + 'T' +
now.getHours() + ':' + now.getMinutes() + ':' +
now.getSeconds() + '-' + (now.getTimezoneOffset()/60)
+ ':' + '00';
-
Modified-
var datetime = now.getFullYear() + '-' + now.getMonth() + '-' + now.getDate() + ' at ' +
now.getHours() + ':' + now.getMinutes() + ':' +
now.getSeconds() + '-' + (now.getTimezoneOffset()/60)
+ ':' + '00';
Line 68:
-
Original-
,'<ins datetime="' + datetime + '">'
-
Modified-
,'<ins datetime="Edit, ' + datetime + '--">'
If I type
This is an insertionbetweeninstags, the output I now get (in Mozilla/Firefox only, not IE) is this:
Edit, 2004-7-26 at 10:47:47-4:00--This is an insertion
Neat, huh? -
Original
The topic ‘I’m proud of this quicktag trick!’ is closed to new replies.