I had added the code to the default WordPress theme a while back, but when I upgraded, it apparently cleared it out. This time I documented the changes I made to the default theme. Changes must be made to two files in “wp-content/themes/default” which is the default theme directory.
The first file is “index.php” and only requires the removal of the comments around “the_author()” portion.
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
The second file is “single.php” and requires the addition of a “the_author()” block similar to the following.
on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> by <?php the_author() ?>
I achieved these changes with the following sed commands.
cd wp-content/themes/default mv index.php index.php.default sed 's/<!-- by <?php the_author() ?> -->/by <?php the_author() ?>/' index.php.default > index.php mv single.php single.php.default sed "s/on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>/on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> by <?php the_author() ?>/" single.php.default > single.php
The better solution is probably to find a theme that does this by default instead of enabling it every time the theme gets updated; however, I haven’t gone looking for a replacement theme yet.
This has been tested with WordPress 2.7.1.
Edit: It is advisable to then set the permissions on those two files back to that of the Apache user:
chown www-data:www-data index.php single.php
This will help prevent possible problems during an upgrade.
One thought on “Show the Author in WordPress”
Comments are closed.