Code Duplication    Length = 11-11 lines in 2 locations

extensions/blocks/homepage-articles/class-newspack-blocks-api.php 1 location

@@ 209-219 (lines=11) @@
206
207
			foreach ( $authors as $author ) {
208
				// Check if this is a guest author post type.
209
				if ( 'guest-author' === get_post_type( $author->ID ) ) {
210
					// If yes, make sure the author actually has an avatar set; otherwise, coauthors_get_avatar returns a featured image.
211
					if ( get_post_thumbnail_id( $author->ID ) ) {
212
						$author_avatar = coauthors_get_avatar( $author, 48 );
213
					} else {
214
						// If there is no avatar, force it to return the current fallback image.
215
						$author_avatar = get_avatar( ' ' );
216
					}
217
				} else {
218
					$author_avatar = coauthors_get_avatar( $author, 48 );
219
				}
220
				$author_link = null;
221
				if ( function_exists( 'coauthors_posts_links' ) ) {
222
					$author_link = get_author_posts_url( $author->ID, $author->user_nicename );

extensions/blocks/homepage-articles/class-newspack-blocks.php 1 location

@@ 380-390 (lines=11) @@
377
			$authors = get_coauthors();
378
			foreach ( $authors as $author ) {
379
				// Check if this is a guest author post type.
380
				if ( 'guest-author' === get_post_type( $author->ID ) ) {
381
					// If yes, make sure the author actually has an avatar set; otherwise, coauthors_get_avatar returns a featured image.
382
					if ( get_post_thumbnail_id( $author->ID ) ) {
383
						$author->avatar = coauthors_get_avatar( $author, 48 );
384
					} else {
385
						// If there is no avatar, force it to return the current fallback image.
386
						$author->avatar = get_avatar( ' ' );
387
					}
388
				} else {
389
					$author->avatar = coauthors_get_avatar( $author, 48 );
390
				}
391
				$author->url = get_author_posts_url( $author->ID, $author->user_nicename );
392
			}
393
			return $authors;