Add Author to Single Post Page (single.php) After Title
-
The current single post page (single.php) shows the date, title and then post. I am trying to get the author to appear after the date and title. Below is the single.php code. I see the while loop for the_post. How might I insert the author and format the text, e.g. maybe wrap a class/div around it?
<?php /** * The template for displaying all single posts. * * @package Daniela */ get_header(); ?> <div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', get_post_format() ); ?> <?php the_post_navigation( array( 'next_text' => '<span class="meta-nav">' . esc_html__( 'Next Post', 'daniela' ) . '</span> ' . '<span class="post-title">%title</span>', 'prev_text' => '<span class="meta-nav">' . esc_html__( 'Previous Post', 'daniela' ) . '</span> ' . '<span class="post-title">%title</span>', ) ); ?> <?php // If comments are open or we have at least one comment, load up the comment template if ( comments_open() || get_comments_number() ) : comments_template(); endif; ?> <?php endwhile; // end of the loop. ?> </main><!-- #main --> </div><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add Author to Single Post Page (single.php) After Title’ is closed to new replies.