0
<p> <?php the_author_meta('description'); ?> <a href="#"> Read More </a> </p>

I just wanted to pull authors link here "#", but I tried many options such as →

get_the_author()
the_author_link() 
the_author_posts_link() 

All of them are pulling authors name also. Any solution that will help me pull Just the authors link?

1

If the_author_meta is already working for you, you should be able to use get_the_author_meta('ID') to pass with the get_author_posts_url();

So, like this:

<a href="<?php echo get_author_posts_url( get_the_author_meta('ID') ); ?>">Read More</a>

Let me know if that works for you!

  • Yes sir, It's working. If you find my posts good and may be useful for future users then please upvote me. – The WP Novice Jun 7 '17 at 2:16
1

If your running this in the loop then you don't need an author ID

    <?php 

if ( have_posts() ) {
while ( have_posts() ) {
    // The post details
    the_post(); 
    // Display link
    $author_link = the_author_meta('user_url'); 
    echo '<p><a href="#'. $author_link. '"> Read More </a> </p>';

} // end while
} // end if
    ?>

If your running this outside the loop then you need an author ID

<?
    $author_link = the_author_meta('user_url','id needed here'); 
    echo '<p><a href="#'. $author_link. '"> Read More </a> </p>';
?>

If you know your author ID

<?
    $author_link = the_author_meta('user_url',02); 
    echo '<p><a href="#'. $author_link. '"> Read More </a> </p>';
?>
  • Yes, I am running this outside the loop. Have you used this in place of the text-domain? → 'id needed here' – The WP Novice Jun 6 '17 at 19:57
  • Yes you will need the authors I'd number as in my last option to get the authors link to their page. Outside the loop an I'd is required – Sam Jun 6 '17 at 20:03
  • How do I get author ID outside the loop? – The WP Novice Jun 6 '17 at 20:11
  • Inside the loop $author_id=$post->post_author; then outside the loop $author_link = the_author_meta('user_url',$author_id); not this will only return the last one as it's outside the loop and not loop each one of the posts so might be best inside the loop. – Sam Jun 6 '17 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.