Customising wordpress templates

Here are a few nice things to add to your wordpress template in case it doesnt have them. The important templates to modify are index.php (the full blog view), single.php (shows single posts) and comments.php (for comments)

Show author and date

Adding the following :

<p>Posted by <?php the_author(); ?> on <?php the_date('F j, Y'); ?> at <?php the_time('g:i a'); ?>
</p>

will give something like

Posted by Tejvan Pettinger on October 12, 2007 at 7:35 am

The arguments for the the_date and the_time functions tell you what format the date and time is in, you can read a full list of them here…

Show category

<?php the_category(' , '); ?>

shows the category; the comma in the brackets tells you what separates the categories if there are more than one of them.

Edit post link

Very handy to be able to edit posts from the actual post itself:

<?php edit_post_link(__(' Edit this post')); ?>

The stuff between the apostrophes is the wording of the link

Comments are closed.