0

Estou usando um tema no wordpress e nele não está aparecendo o nome do autor nas postagens.

Achei esse link falando sobre o código pra colocar o nome nas postagens: https://codex.wordpress.org/Function_Reference/get_the_author

Tentei mas mesmo assim não apareceu. Segue o código:

<?php
/**
 * The main template file
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 *
 * @link       https://codex.wordpress.org/Template_Hierarchy
 *
 * @package    fonts
 * @copyright  Copyright (c) 2019, Danny Cooper
 * @license    http://opensource.org/licenses/gpl-2.0.php GNU Public License
 */



get_header(); ?>

<div class="content-area">	

	<?php
	
	
	if ( have_posts() ) :


		if ( is_home() && ! is_front_page() ) :
			?>

											<?php 	the_author(); ?>

						<?php $author = get_the_author(); ?>

			<header>
				<h1 class="page-title"><?php single_post_title(); ?></h1>


			</header>


			<?php
		endif;

		/* Start the Loop */
		while ( have_posts() ) :

			the_post();

			/*
			 * Include the Post-Format-specific template for the content.
			 * If you want to override this in a child theme, then include a file
			 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
			 */
			get_template_part( 'template-parts/content', 'archive' );




		endwhile;

	else :

		get_template_part( 'template-parts/content', 'none' );

	endif;
	?>

</div><!-- .content-area -->

<?php
get_footer();

Segue código de content-archive.php (template-parts/content-archive.php):

<?php
/**
 * Template part for displaying page content in page.php
 *
 * @link       https://codex.wordpress.org/Template_Hierarchy
 *
 * @package    fonts
 * @copyright  Copyright (c) 2019, Danny Cooper
 * @license    http://opensource.org/licenses/gpl-2.0.php GNU Public License
 */

?>

<article <?php post_class(); ?>>

	<?php fonts_thumbnail( 'fonts-blog' ); ?>

	<header class="entry-header">

		<div class="entry-meta">
			<?php fonts_posted_on(); ?>
		</div><!-- .entry-meta -->

		<?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?>

	</header><!-- .entry-header -->

	<div class="entry-content">
		<?php the_excerpt(); ?>
		<p><a class="moretag" href="<?php echo esc_url( get_permalink( $post->ID ) ); ?>"><?php esc_html_e( 'Continue Reading &rarr;', 'fonts' ); ?></a></p>
	</div><!-- .entry-content -->

</article><!-- #post-## -->

Alguém sabe o que pode ser?

10
  • Você que inseriu esses códigos: <?php the_author(); ?>, <?php $author = get_the_author(); ?>? 23/04/2019 às 16:31
  • posta o conteúdo do arquivo 'template-parts/content', 'archive' 23/04/2019 às 16:44
  • Isso, foi eu quem inseri esses códigos.
    – Márcio
    23/04/2019 às 16:58
  • publiquei o código do arquivo mencionado.
    – Márcio
    23/04/2019 às 17:00
  • Para adicionar algo a pergunta você deve editar a pergunta e adicionar o conteúdo extra. 23/04/2019 às 17:02

0

Você deve fazer log-in para responder a esta pergunta.

Pesquise outras perguntas com a tag .