Hi,
I wanted to add the author name to the blog posts on the front page of my site: digitalnomadquest.com
Here is an example:
on the bottom right of the front page:
Any way to do this?
Thanks!
Sharon
Hi,
I wanted to add the author name to the blog posts on the front page of my site: digitalnomadquest.com
Here is an example:
on the bottom right of the front page:
Any way to do this?
Thanks!
Sharon
Hey Sharon,
This is possible through some customization but it depends on the setup of your site. Is the site you are wanting to apply to to digitalnomadquest.com? If so, the recent blog post section seems to be using the recent post element which seems to already have customizations.
Please add this code in the functions.php file of the child theme after the </div>
of the <div class="x-recent-posts-excerpt">
block:
. '<div class="x-recent-post-author">by: ' .get_the_author() .'</div>'
Kindly note that since this is a custom code that changes the default behavior/display of the theme, you will be responsible to maintain or update the code in case you require further changes or if the code stops working in future updates. If you are uncertain how to proceed, it would be best to get in touch with a developer.
Hope this helps.
Could you explain what this means:
Kindly note that since this is a custom code that changes the default behavior/display of the theme, you will be responsible to maintain or update the code in case you require further changes or if the code stops working in future updates. If you are uncertain how to proceed, it would be best to get in touch with a developer.
??
Is there one that won’t affect my site like this?
Hi Sharon,
Any customization that is not native to the theme falls beyond the scope of our support but we do suggest some custom codes that will work in the current setup of your site. Since these are custom codes are you are overriding the default theme display we won’t be able to tell in the future if any of this code will stop working or not so you will have to maintain the codes yourself. However, there is a small chance of the code not working in the future update.
No, the only way to add the author to the recent post element is to override the recent post shortcode that is native to the theme through the functions.php file of the child theme.
Hope this helps.
Is there any chance that the code could mess up my site and I won’t be able to access it?
Hello Sharon,
I went ahead and edited your child theme’s functions.php file. In the line 115, I added this:
. '<span class="x-recent-post-author right">by: ' . get_the_author().'</span>'
You should now be seeing the Author name on the right side below the excerpts. Please be advised that you cannot add a link to it because the whole item is already being linked to the posts itself. Nesting of links is not allowed in HTML by default.
Kindly check your site now.
This is so awesome! Thank you! Is there any way to make the author name the Name instead of the Username? And is there any way to make the font black?
And also for the blog post view it looks like it shows username not Author name:
Also can we make the font smaller? for the author name. Thanks!
Hey Sharon,
You can change the Author display name in Users > Your Profile ({Username}) > Display name publicly as and change it to your desired name to display.
I went ahead and change it already. I also made the font size smaller by adding this custom css:
.x-recent-posts .x-recent-post-author {
font-size: 14px;
}
Please check your homepage now.
This is so great! THANK YOU!
You’re welcome!
We’re glad we were able to help you out.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.