Support » How-To and Troubleshooting » Link to Posts by specific Author from menu

Link to Posts by specific Author from menu

  • I’ve been reading the author_page help in the codex but can’t seem to find what I want.

    I want to be able to add a menu item that links to posts by a specific author, and I can’t seem to figure it out. I know there’s code to get a list of authors, and then from there to link to their posts, but I want it more specific.

    For example, if I have an author named Bob, I want a menu entry labeled ‘Bob’ with a link to a page of his posts. I’m guessing I need to pass his user ID to that page for it to happen, and I’m fine with finding the users’ IDs, but creating a page of posts from that ID is where I fall over.

    Any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi


    Forum Moderator

    That’s the page I’ve read, as far as I can see in there there’s no way to link to a specific user’s posts page from a menu entry, only from either clicking on their name on a post, or from creating a list of authors and linking from there.

    Unless I’m missing something?



    Forum Moderator

    To create a menu link, I think you’d need to set up a custom menu and then use the Custom option to add your specific author links.

    I really need to know:

    a) the code to put in The Loop on the author’s page, like this;

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
                <?php the_title(); ?></a>,
                <?php the_time('d M Y'); ?> in <?php the_category('&');?>
        <?php endwhile; else: ?>
            <p><?php _e('No posts by this author.'); ?></p>
        <?php endif; ?>

    and b) what to put as the url for the menu entry, like http://www.myurl.com/authors/userid=3 or whatever?

    I’m not sure if I’m putting across what I’m trying to do well enough.



    Forum Moderator

    a) Have another look at the author templates page I linked to above. There’s sample code on there.

    b) http://www.myurl.com/?author=3

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Link to Posts by specific Author from menu’ is closed to new replies.