I am trying to create a link in my template that allows the user to see there own blog posts the code that i am using is <li><a href="?author=<?php the_author_ID(); ?>">test</a></li>
but it is only taking me to ?author=
1 Answer
the_author_ID()
says in Codex:
It displays the unique numeric user ID for the author of a post; the ID is assigned by WordPress when a user account is created. This tag must be used within The Loop.
So, it won't work.
Try using the following code* within a loop:
<li class="author vcard">
<a class="url fn n" href="<?php echo get_author_posts_url( false, $authordata->ID, $authordata->user_nicename ); ?>" title="<?php printf( __( 'View all posts by %s', 'my-theme' ), $authordata->display_name ); ?>"><?php the_author(); ?></a>
</li>
* Thanks to Ian Stewart
-
I want it so in the main menu there is a link saying blog and it links to the users post Commented Sep 10, 2013 at 17:57
-