• hi

    i’m working on an author profile page, where i’d like to include the author name, description, and (links to) their posts.

    i have an author.php page with:

    <?php
    if(isset($_GET['author_name'])) :
    $curauth = get_userdatabylogin($author_name);
    else :
    $curauth = get_userdata($author);
    endif;
    ?>
    .
    .author name, author description
    .
    <!-- The Loop -->
    <?php if ( have_posts() ) : ?>
    <?php 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 else: ?>
    <h2 class="center">Nope</h2>
    <?php endif; ?>
    <!-- End Loop -->

    this works fine when the user has posted stuff, but when they haven’t it displays the ‘Not found…’ i.e. the comment i have in my else statement on my index.php.

    any one know why it doesn’t display the user profile, followed by a ‘nope’?

    thanks in advance,

    b9

  • The topic ‘if have_posts … else’ is closed to new replies.