Getting $curauth on a non-post page
-
Hello,
I have a section of a site Im working on that I would like to list all posts by a specific author, however it is not inside wordpress so the example in
https://codex.www.ads-software.com/Author_Templatesdoesn’t exactly work for my purposes. I’ve tried hacking the code here to make it work but Ive had no luck. It doesn’t seem to pull any of the articles as all it ever shows is no posts by author.
Here’s what I’ve got
<?php require('/home/httpd/vhosts/host.com/httpdocs/news/wp-blog-header.php');?> <!-- This sets the $curauth variable --> <?php $curauth = 'admin';?> <h2>View all blog posts by <?php echo $curauth; ?>:</h2> <ul> <!-- The Loop --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <li> <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('&');?> </li> <?php endwhile; else: ?> <p><?php _e('No posts by this author.'); ?></p> <?php endif; ?> <!-- End Loop --> </ul>
- The topic ‘Getting $curauth on a non-post page’ is closed to new replies.