[Resolved] Help Please For Code To Add Author’s Names To Posts
I am using the Cut Line theme and I have edited my theme’s index.php file with the following code in order to show author’s names on blog posts on the front page of the site:
<small><?php the_time(‘F jS, Y’) ?> by <?php the_author() ?> </small>
The problem is that when someone reads a blog post from either one of the category pages or goes to the page to add a comment onto the post, then the original author’s name of the post no longer appears.
I assume I need to edit the code within some of the other php files within the theme in order to affect these other pages too.
Can anyone please advise what code I should change and on which php pages of the theme?
look in you theme folder for a file named single.php or something similar
Thanks. Do you think that will cover all other site pages within the theme if I edit that one too?
Thanks, I edited the file named single.php by using the following code string:
<h4><?php the_time(‘F jS, Y’) ?> by <?php the_author() ?> –> <?php comments_number(‘No Comments’, ‘1 Comment’, ‘% Comments’); ?></h4>
This has sorted out showing of the author’s name in all expanded post screens where people can add in comments.
What is still not showing the author’s name though are the category pages where it shows a summary of each post within that category.
Not sure where I have to edit the code to affect showing authors name’s on posts within the categories.
you can check the archive.php and category.php if your theme has it.
Thanks. I edited the archive.php file too (no have category.php) and that has done it. Great. You are a life saver.
I was successful in editing my index.php to display “by XXXXXX”. “X” equals author display name. That was my first time at this; however, now I want to do what the member above did. I want the author display name to display on all their posts, even when not on the main page, i.e. in archives. Thanks in advance for any help you can provide.
Please try to be specific. I’m reading what I can on this, but I’m hesitant to change code without being certain if it’s the correct line.
- The topic ‘[Resolved] Help Please For Code To Add Author’s Names To Posts’ is closed to new replies.