Forums

author's description in sidebar limited to 50 character. how to ? (4 posts)

  1. jeeremie
    Member
    Posted 2 years ago #

    Hi, I want to use the_author_meta('description') in sidebar for to display information about the post author:

    <?php the_author_meta('description'); ?>

    I want to limit description to 50 characters only and place a link to the author's page if user want to read more about it.

    Google didn't return anything about that. Does anyone know how to do that?

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Something like:

    $author_desc = get_the_author_meta('description');
    echo 'Description ' . substr($author_desc,0,50);
    
    $author_url = get_the_author_meta('user_url');
    echo 'URL ' . $author_url);
  3. jeeremie
    Member
    Posted 2 years ago #

    Thanks. I will try that and let you know.

  4. jeeremie
    Member
    Posted 2 years ago #

    Ok, I had time to check your code. That works for description but not for url

    your code get_the_author_meta('user_url'); returns the author website but I want to get the author page on the site. It should be something like http://domain.com/?author=1

    So far my code is :
    View <?php the_author_posts_link(); ?>'s Profile &raquo;

    ... which returns the post author name with a link to his profile/author page (e.g. http://domain.com/?author=1)

    How should I proceed to retrieve only the url and remove the post author name? (I'd like to write "View Full Profile" and make it a link to the author page).

    Thanks for your time.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.