WordPress.org

Ready to get started?Download WordPress

Forums

Individual Author archive Page shows Posts by All Authors (3 posts)

  1. ruhelamin
    Member
    Posted 1 year ago #

    Hi, i have several authors on my blog (not live yet, working on wamp), and in each post i have a 'posted by (the_author_posts_link();)' line that links to the individual authors page which should show a list of all posts by that author only. However, it is showing all posts by all authors. This is the case no matter which individual author page you go to. Any ideas what's wrong here?

    I'm using several Custom Post Types by the way and an author could have posts in all those CPT's.

    Please help, thanks in advance.

  2. Andrew Bartel
    Member
    Posted 1 year ago #

    Is there an author.php in your theme that you could debug?

  3. ruhelamin
    Member
    Posted 1 year ago #

    Sorry completely forgot to mention that yes i do have an author.php file.

    For the most part, i'm using the code from 'Sample Template File' section in codex page for Author Templates. Just adapted the html a little. The code is now:

    <?php get_header(); ?>
    
    <div id="bg_5" class="bg_bands"><!-- Background Band 5: Start -->
    <div class="main_area"><!-- Main Individual Content Area: Start -->
    
    <div id="content"><!-- CONTENT: Start -->
    
      <h1 style="color:#f60; font-size:40px;">THIS IS AUTHOR.PHP TEMPLATE</h1>
    
    <!-- This sets the $curauth variable -->
    
        <?php
        $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
        ?>
    
        <h2>About: <?php echo $curauth->nickname; ?></h2>
        <dl>
            <dt>Website</dt>
            <dd><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></dd>
            <dt>Profile</dt>
            <dd><?php echo $curauth->user_description; ?></dd>
        </dl>
    
        <h2>Posts by <?php echo $curauth->nickname; ?>:</h2>
    
        <ul>
    <!-- The Loop -->
    
    	<?php query_posts( array(
                'post_type' => array(
                            'videos',
                            'events',
                            'courses',
                            'articles',
                            'shorts',
                            'poetry',
                            'revert-stories',
                        ),
                        'paged' => $paged ) // for paging links to work
                    );
        ?>
    
        <?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; ?>
    
      <?php wp_pagenavi(); ?>
    
      <?php else : ?>
    
            <p><?php _e('No posts by this author.'); ?></p>
    
        <?php endif; ?>
    
    <!-- End Loop -->
    
        </ul>
    </div>
    
    </div><!-- CONTENT: End -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic