• Im reading slowly how to make theme.

    I found those two and i see the difference in usage.

    With parameter the post_id i suppose the_author can do a lot, like maybe (have no idea if those exist) get author of the last post in another category and show it in another post.

    On the other side get_the_author() has no parameters, there is one deprecated, and it seems like it can only show author for the actual post, which i supposed the_author() with no parameter is what it do if im right.

    It even uses another variable to work like:

    $author = get_the_author()

    Which make me believe it may be a soon to be discontinued tag.

    And that the_author is the new one that you are supposed to use in any new theme. Am i right. Or am i misunderstunding how they work.

Viewing 1 replies (of 1 total)
  • J M

    (@hiphopinenglish)

    The largest difference is what you’re trying to do with them.
    the_author simply echoes the author’s name for a particular post.
    Whereas get_the_author allows you to manipulate content based on the author it calls. For example, as you rightly say, you could code link “another post from this author” after a post.
    Using $author = get_the_author() means you have the $variable author do what you like (use in a new wp_query for example). Echoing it would essentially be the equivalent of using the_author.

    BTW I’m not a WP pro, that’s just what I understood from reading the codex.

Viewing 1 replies (of 1 total)
  • The topic ‘difference between get_the_author() and the_author()’ is closed to new replies.