• Resolved awlang

    (@awlang)


    I’d like to know what additional css I need to add to be able to show the author of each post when they appear on the Posts page. Hopefully an easy fix, thanks.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Kavya Gokul (a11n)

    (@properlypurple)

    Hey @awlang ! It looks like the only way to do this is by editing the theme’s templates. The best way to do this is by creating a child theme. If you decide to go this way, an easier way would be to use a plugin to generate a child theme.

    If you go this way, you will be able to copy template-parts/post/content.php from the main theme, and modify that.

    Thread Starter awlang

    (@awlang)

    Thanks Kava, I have made a child them as you suggest and have opened the content.php file as directed, but I don’t have much experience of editing php. I’ll paste the original here, would you be able to tell me what the edit should be?

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<?php
    	if ( is_sticky() && is_home() ) :
    		echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
    	endif;
    	?>
    	<header class="entry-header">
    		<?php
    		if ( 'post' === get_post_type() ) {
    			echo '<div class="entry-meta">';
    			if ( is_single() ) {
    				twentyseventeen_posted_on();
    			} else {
    				echo twentyseventeen_time_link();
    				twentyseventeen_edit_link();
    			}
    			echo '</div><!-- .entry-meta -->';
    		}
    
    		if ( is_single() ) {
    			the_title( '<h1 class="entry-title">', '</h1>' );
    		} elseif ( is_front_page() && is_home() ) {
    			the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' );
    		} else {
    			the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
    		}
    		?>
    	</header><!-- .entry-header -->
    
    	<?php if ( '' !== get_the_post_thumbnail() && ! is_single() ) : ?>
    		<div class="post-thumbnail">
    			<a href="<?php the_permalink(); ?>">
    				<?php the_post_thumbnail( 'twentyseventeen-featured-image' ); ?>
    			</a>
    		</div><!-- .post-thumbnail -->
    	<?php endif; ?>
    
    	<div class="entry-content">
    		<?php
    		the_content(
    			sprintf(
    				/* translators: %s: Post title. Only visible to screen readers. */
    				__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
    				get_the_title()
    			)
    		);
    
    		wp_link_pages(
    			array(
    				'before'      => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
    				'after'       => '</div>',
    				'link_before' => '<span class="page-number">',
    				'link_after'  => '</span>',
    			)
    		);
    		?>
    	</div><!-- .entry-content -->
    
    	<?php
    	if ( is_single() ) {
    		twentyseventeen_entry_footer();
    	}
    	?>
    
    </article><!-- #post-<?php the_ID(); ?> -->
    Thread Starter awlang

    (@awlang)

    I’ve achieved the fix after quite a lot of trial and error code editing in the child theme. For the record, the edit I made is on line 28 of the content.php file in the posts folder. The original line is:

    echo twentyseventeen_time_link();

    And this changed to:

    echo twentyseventeen_posted_on();

    Maybe this will be helpful to someone else in the future.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Author Display on Posts page in Twenty Seventeen’ is closed to new replies.