WordPress.org

Support

Support » How-To and Troubleshooting » Author In Page Title?

Author In Page Title?

  • 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?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Can I see the full author.php file.

    (use pastebin please)

    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.

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

    Thanks man.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Author In Page Title?’ is closed to new replies.