Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #36117
    Terry
    Guest

    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?

    #36160
    Jesse Owens
    Keymaster

    Hi 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 value 64 to adjust the size of the photo, and feel free to add any HTML markup in the string.

    #36187
    Terry
    Guest

    Many thanks, Jesse, everything worked just fine.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Where is the GridOne Author Page Template?’ is closed to new replies.