I am having trouble adding author on each pages of a website built in WordPress. Any idea how can I do that automatically?



WordPress has a function which does this for you. You'll need some experiences with HTML, CSS, PHP to style the output and understand what that function does:

In your theme will most likely be a page.php template where you can add these on pages into The Loop like so:

<?php if( have_posts() ) : ?>
    <?php while( have_posts() ) : the_post(); ?>
        <div class="author"><?php the_author(); ?></div>        
    <?php endwhile; ?>      
<?php endif; ?>

Keep in mind you should create a child theme to do a change like that in order to avoid losing any data if the theme updates.

  • Thanks Castiblanco, I've already tried with the_author(), unfortunately it placed the author above the breadcrumbs. We still need to do some CSS changes in order to have it solved. – Florin Draghia Sep 4 '18 at 14:07
  • Well, that's not the question here, you can edit your question adding the complete code and what you want to achieve – Castiblanco Sep 4 '18 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.