Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #70642

    Blake K
    Participant

    How do I add the author’s name to my posts?

    #70654

    Blake K
    Participant

    FYI, I am using Integrity stack.

    #70975

    Rad
    Moderator

    Hi Blake,

    Thank you for writing in!

    Add this code at your child theme’s functions.php

    add_filter( 'the_content', function( $content ) { return $content.( is_singular() ? '[author]' : '' ); } );
    

    Cheers!

    #104558

    Suzanne1986
    Participant

    Hi everybody,

    I just found this topic and followed your advice. The thing is, now the authors name and avatar appear in every page of my site and not just in the blog posts as I wanted. Is there anything I cad add to the code you provide to make it work just for the blog posts? Is there any way to turn it off in the rest of the site?

    #104568

    Mrinal
    Member

    Hi Suzanne,

    To do so, add the following:
    add_filter( 'the_content', function( $content ) { return $content.( is_single() ? '[author]' : '' ); } );