Support » Fixing WordPress » How to make the name of the author display
11 years, 1 month ago
I want to name of the author to show for each entry – how is this done?
Just add this php code to your template to display the post authors name:
<?php the_author(); ?>
Please help out a newbie – which file do I modify, and where in it do I place the code? I’m using the default.
Check your index.php file. Within the stuff known as The Loop, you may see that code already there, surrounded by “comment tags” like these:
Take out those comment tags and you should have the author’s name in posts.
Sorry – I forgot to mention I’m running 2.02
My index.php file just says “short and sweet” and “require header”.
That would be the index.php file in your wp-content/theme/whateverthemeyouareusing folder.
Ooops – sorry, should have been a bit more exact!
That did the trick – you guys rock!
Is there any way I can preface it with the text “posted by” or something to that effect?
Yeah…. look for this:
<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> — <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit')); ?></div>
Replace with this:
<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> — <?php the_author() ?> @ <?php the_time() ?> Posted by <?php edit_post_link(__('Edit')); ?></div>
Actually , I tried inserting the text before the <php> command an it works like a charm!
Thanks for all the help. 🙂
Heh. Beat me to it, have fun!