How do I get the time and date to appear under my posts once I publish it?
-
Hi all
This is my first time posting and trying to blog. I would like to know how I get the time and date to appear under my posts once I publish it? Some sites gave me a code of sorts but I am sure there is a much simpler way to do it right?
The blog I need help with is: (visible only to logged in users)
-
The absolute easiest way is to choose a theme that does that automatically. Otherwise, I’m afraid you have to add it in by hand.
You might be able to find a list of those themes here:
-
When you say by hand, you mean everytime? I tried to enter a code earlier but they say I have to purchase an upgrade to get it to show. Is that true?
-
Without seeing the code, I can’t say for sure but it probably won’t work. Paste the code here so we can look at it: put it between backticks, those little marks on the same key as ~ usually, so that the code shows up properly. So Backtick, all the code, Backtick.
Most codes of that nature are dynamic and javascript-based, and they will be stripped out here for reasons of security. It’s much easier to choose a theme that adds in the time automatically.
-
add_filter('the_time', 'timeago'); function timeago() { global $post; $date = $post->post_date; $time = get_post_time('G', true, $post); $time_diff = time() - $time; if ( $time_diff > 0 && $time_diff < 24*60*60 ) $display = sprintf( __('%s ago'), human_time_diff( $time ) ); else $display = date(get_option('date_format'), strtotime($date) ); return $display; } -
Where are you supposed to be putting that code? It will not work in the HTML editor of a post.
-
Basically, at WordPress.com unless the theme has time/date functionality built in, you cannot add it. You don’t have access to the underlying theme to put them in, and that code can’t be added on a post by post basis. Like I said, the best solution is to choose a theme that has that already OR type it in every single time by hand.
-
If you do decide to do it manually the Firefox Timestamp plugin would probably help
-
-
All themes automatically display the date. Themes displaying time as well listed here:
-
- The topic ‘How do I get the time and date to appear under my posts once I publish it?’ is closed to new replies.