Author.php
-
Hi,
I am having issues setting up an author.php page in order to display user/author information. I ideally want each author to have thier own page with the info linked from their user account.
the theme did not have author.php or even and archive.php so I have used the following for author.php but its not working.
<?php /** * The template for displaying Archive pages. * * Used to display archive-type pages if nothing more specific matches a query. * For example, puts together date-based pages if no date.php file exists. * * Learn more: https://codex.www.ads-software.com/Template_Hierarchy * * @package WordPress * @subpackage Twenty_Eleven * @since Twenty Eleven 1.0 */ get_header(); ?> <div id="content" class="narrowcolumn"> <!-- This sets the $curauth variable --> <?php if(isset($_GET['author_name'])) : $curauth = get_userdatabylogin($author_name); else : $curauth = get_userdata(intval($author)); endif; ?> <h3>About: <?php echo $curauth->display_name; ?></h3> <p><strong>Website:</strong> <a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></p> <p><strong>Profile:</strong> <?php echo $curauth->user_description; ?></p> <h3>Posts by <?php echo $curauth->display_name; ?>:</h3> <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> </li> <?php endwhile; else: ?> <p><?php _e('No posts by this author.'); ?></p> <?php endif; ?> <!-- End Loop --> </ul> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
You can see the issue here: https://blog.blueventures.org/
Click on any of the posted by names and it just loops you to the home page.thanks
- The topic ‘Author.php’ is closed to new replies.