WordPress.org

Ready to get started?Download WordPress

Forums

Author In Page Title? (5 posts)

  1. alanchrishughes
    Member
    Posted 2 years ago #

    I've been reading up on this and apparently for some reason you can only use the the_author(); inside the loop. I had made an author.php file to display all articles by each author and obviously want to include their names in the title of the page and listed on the page so people would know what they are looking at. I slopped this together for the page title...

    elseif ( is_author() ) 
    
    { bloginfo('name'); echo ' - Articles '; if (have_posts()) : while (have_posts()) : the_post(); the_author(); endwhile; endif;}

    On for on the page itself I tried this...

    <?php $loop = new WP_Query('posts_per_page=1' ); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php the_author(); ?>
    <?php endwhile; ?>
    <?php endif; ?>

    And it does work to display the author's name, but it displays it over and over for each article listed on the page.

    Is there a way around this?

  2. Jerry
    Member
    Posted 2 years ago #

    Can I see the full author.php file.

    (use pastebin please)

  3. alanchrishughes
    Member
    Posted 2 years ago #

    I would but it is a giant mess and I think I actually figured it out, just moving the_autheor(); to after the endwhile; but before the endif; seems to have done the trick. But this is usually when I get stoked that I actually got something to work and then it crashes on me again.

  4. Jerry
    Member
    Posted 2 years ago #

    Haha, I understand. Try developing a full real estate WordPress theme :) Feel free to ask if you need anymore help.

  5. alanchrishughes
    Member
    Posted 2 years ago #

    Thanks man.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.