Viewing 4 replies - 1 through 4 (of 4 total)
  • where do you want to show the author?

    in the same line as the date and number of comments?

    in this case,
    edit content-entry.php of your theme (ideally in a child theme), and edit this section:

    <div class="entry-meta entry-meta-bottom">
    			<time class="entry-date" itemprop="datePublished" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time>
    			<a href="<?php echo esc_url( get_comments_link() ); ?>" class="entry-comments-no"><?php comments_number(); ?></a>
    		</div>

    what function to add where depends on what exactly you want to show, like just the author name, or linked to the author page, or ..?

    useful links:
    https://codex.wordpress.org/Function_Reference/the_author
    https://codex.wordpress.org/Function_Reference/the_author_link
    https://codex.wordpress.org/Function_Reference/the_author_posts_link
    https://codex.wordpress.org/Function_Reference/the_author_meta

    Thread Starter foxyfrank

    (@foxyfrank)

    I want to edit the line you’re mentioning. Could you show me the exact php text? It should be a link to the auhtor page.

    example (to replace the previously posted section in content-entry.php):

    <div class="entry-meta entry-meta-bottom">
    			<time class="entry-date" itemprop="datePublished" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time>
    			 <span class="author"> <?php the_author_posts_link(); ?></span>
    			<a href="<?php echo esc_url( get_comments_link() ); ?>" class="entry-comments-no"><?php comments_number(); ?></a>
    		</div>

    puts the author link in the middle between date and comments;
    you can use .author in the CSS to style it if needed.

    Thread Starter foxyfrank

    (@foxyfrank)

    Thank you very much!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Add 'author' to blogposts’ is closed to new replies.