Some Wordpress themes have no time stamp in the design. A time stamp is the date and time you publish your blog post, and it usually shows up beneath the title of your post after it’s published on the blog. Most blog themes do have this feature, but not all. This theme I am currently using (Revolution Blue- the excellent freeware version and it has no footer links to weight loss pills or anything!) has the date but not the time. That’s fine with me. But I have other blogs that I want to display both date and time published. So here’s some information if you want to display more or less on your blog. Remember, there are so many different themes. This fix just may not work for your theme. Be SURE to backup your files before ever tinkering with the code!!!
Firstly, I got this bit of information from the Wordpress forums. The forums are a great place to find information. It can be a little perplexing for a newbie at times, so I usually search the web as well as read the forum articles. OK, so.. this is my narrative of how I changed the time stamp for one of my blogs.
Take a look at the WordPress Default 1.6 theme’s wp-content/themes/default/index.php file for an example of Template_Tags/the_time
…After this line:
<h1>" rel="bookmark"><?php the_title(); ?></h1>
Add this line:
<?php the_time('F jS, Y'); ?>
From this information, I knew where to look. But I wanted only the time to show, not the date. So I found this here:
Displays the time using the format parameter string '09:18 am' (ex: 10:36 pm).
<p>Time posted: <?php the_time('g:i a'); ?></p>
and knew we were getting somewhere.
I put the code in my Index Template sheet, but altered it to this:
at <?php the_time('g:i a'); ?>
I didn’t want “Time posted:” as it seemed too sterile. Since I was placing the time right below the post title and after the category and author loop, I changed it to “at.” I also removed the < p > < /p > tags because I wanted the time stamp to be on the same line as my category and author loop line. So my finished piece of code ran (with my addition in bold):
< div class=”item_text1″>
< a href=”<?php the_permalink() ?>”><?php the_title(); ?>< /a>
< /div>
< div class=”item_text2″>
Filed Under (<?php the_category(‘, ‘) ?>) by <?php the_author() ?> at <?php the_time(‘g:i a’); ?>
< /div>
And it worked!
And P.S. I found that I had to change the time stamp setting for archived posts, too. They had been showing up as “Filed Under [category] by Mrs. Mecomber 2007-04-25. All of the archived posts, for some reason! I had to fix this.
Here’s the code I used in my Archives theme sheet:
<div class=”item_text2″>
Filed Under (<?php the_category(‘, ‘) ?>) by <?php the_author() ?> at <?php the_time(‘g:i a’); ?>
</div>
I hope this may shed a little light for you, too, should you need it. And you may find that if you have a theme with a lot of files (singlepost.php, etc), you will need to change the code in all these files for the time stamp to show up on the main home page as well as individual posts and pages. Of course, you can opt to only display the time and/or date for just the home page. Whatever. But always back up your data before you do anything- very important!
Tags: time stamp, Wordpress