• Resolved fmarzocca

    (@fmarzocca)


    In the post (outside the Loop) I need to show the author’s name, and this is easy with:

    $authorname = get_the_author();

    But I’d also like to add a link to author’s posts page, but I can’t get it from the author’s name. No way to get the author’s ID…

    Any suggestion?

    Thanks

    Fabio

Viewing 2 replies - 1 through 2 (of 2 total)
  • You say both “In the post” and “outside the Loop,” so I’m not entirely sure what that means in this context.

    Does “in the post” but “outside the loop” mean you are inside a single post template (single.php), after while have_posts has run?

    Is the post object still available? If so you can retrieve the author id from the post object (i.e. $post->post_author), then you can access anything about the author from there.

    Thread Starter fmarzocca

    (@fmarzocca)

    Sorry for the confusion. I am writing a shortcode to be placed into a post.
    I have fixed my issue: I was forgetting to declare the variable $post as global.

    Thank you

    Fabio

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Need link to author posts page’ is closed to new replies.