Forums

[resolved] Author name cannot be displayed on archive page? (5 posts)

  1. mtonumaa
    Member
    Posted 3 years ago #

    On my sidebar i have:

    TAGS
    - Tag 1
    - Tag 2

    CATEGORIES
    - Cat 1
    - Cat 2

    AUTHORS
    - Author 1
    - Author 2

    TAGS and CATEGORIES work fine, they display the appropriate <h2> title.

    But when user click AUTHORS, the <h2> reads just "Author: ". No name shows up.
    What can i do? Is it because i'm on an Archive page?

    My archive.php:

    <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
    <h2 class="title">Tag: ‘<?php single_tag_title(); ?>’</h2>

    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h2 class="title">Category: <?php single_cat_title(); ?></h2>

    <?php /* If this is an author archive */ } elseif (is_author()) { ?>
    <h2 class="title">Author: <?php the_author(); ?></h2>

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

  3. mtonumaa
    Member
    Posted 3 years ago #

    esmi, thanks for your reply, but it doesn't help i'm afraid.
    I was looking for a solution on that page earlier today..

    <?php wp_list_authors(); ?> - generates a list of authors. Only the name the user clicked needs to be displayed.

    The 3 following output nothing, since i'm not on a post page, but archive page:
    <?php the_author_posts_link(); ?>
    <?php the_author() ?>
    <?php echo $curauth->nickname; ?>

  4. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

  5. mtonumaa
    Member
    Posted 3 years ago #

    Esmi, you were right! :D

    I am idiot.
    How i missed the "Template hierarchy" part, is beyond me.

    Thank you so much! :)

Topic Closed

This topic has been closed to new replies.

About this Topic