• Hello,
    I have a question thats acctually driving me nuts!
    In a theme I use
    <?php the_author_posts_link(); ?>
    to show a link to all other posts an author has made.
    Works like a charm!

    But the code is deprecated!

    WP Codex tell met to use:
    <?php get_author_posts_url( $author_id, $author_nicename ); ?>
    I really cant get it to work the same as the old code

    Can anyone give me some tips!

    Thank u so much!

Viewing 7 replies - 1 through 7 (of 7 total)
  • <?php
    if(isset($_GET['author_name'])) {
      $curauth = get_userdatabylogin(get_the_author_login());
    } else {
      $curauth = get_userdata(intval($author));
    }
    get_author_posts_url($curauth->ID);
    ?>

    Try this

    Thread Starter tweemeterpeter

    (@tweemeterpeter)

    Thanx but it does not work:

    its echos the path but the ID is no where?

    any otherr ideas?

    <?php
    if(isset($_GET[‘author_name’])) {
    $curauth = get_userdatabylogin(get_the_author_login());
    } else {
    $curauth = get_userdata(intval($author));
    }
    echo get_author_posts_url($curauth->ID); ///prints:https://lokaal108.nl/wpaanmelden/author/
    ?>

    This is not very clean but it works:

    <a href="<?php echo get_option('siteurl'); ?>/author/<?php the_author_meta( 'user_login' ); ?>">View all articles by this author</a>

    Thread Starter tweemeterpeter

    (@tweemeterpeter)

    ThanX!

    I found this:
    <?php $author = get_the_author();
    echo get_author_posts_url( ).$author;
    ?>
    Also works!
    Or is this even more dirty???

    This one is clean ??

    Thread Starter tweemeterpeter

    (@tweemeterpeter)

    eh… is that sarcasm?
    Which one is better to use?

    thx!

    This one

    <?php $author = get_the_author();
    echo get_author_posts_url( ).$author;
    ?>

    No sarcasm, only sincerity ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Link to all posts of current Author’ is closed to new replies.