Tagged: Advanced Customization
- AuthorPosts
- April 15, 2021 at 2:43 pm #36117TerryGuest
Hi there, I am currently using Grid One theme and trying to find the file responsible for the author page as I want to display the author’s photo there. But I can’t seem to find anything that would even point me in the right direction. Could you please help me out?
April 15, 2021 at 2:56 pm #36160Jesse OwensKeymasterHi Terry-
Thanks for reaching out, and thanks for using the Grid One WordPress theme.
Unless you’re creating a child theme for Grid One, I don’t recommend trying to edit the theme files directly. The main reason for this is because any modifications you make will be overwritten when you update your theme in the future.
That being said, probably the best place to start is the
boldgrid-gridone/templates/entry-header-archive.php
file. This is the one responsible for displaying the title of any archive page, including the author archive.A better way to accomplish this would be to use a WordPress Filter to add the avatar. You can accomplish this using a plugin like Code Snippets so you don’t have to modify your theme files.
Here’s an example code snippet you can use to accomplish this:
add_filter( 'get_the_archive_title', function ( $title ) { if( is_author() ) { $title = get_avatar( get_the_author_meta( 'ID'), 64 ) . ' ' . $title; } return $title; });
This filter intercepts the built-in function to display the archive title, tests whether it is an author archive with
is_author()
, then adds the avatar photo to the begining of the title. Change the value64
to adjust the size of the photo, and feel free to add any HTML markup in the string.April 16, 2021 at 12:43 pm #36187TerryGuestMany thanks, Jesse, everything worked just fine.
- AuthorPosts
- The topic ‘Where is the GridOne Author Page Template?’ is closed to new replies.