所以我在检索get_author_posts_url()
- 我仍在学习过程中,想知道为什么会发生这种情况:
代码如下:
<!-- Locate the header.php file under /templates/ -->
<?php include(locate_template(\'templates/header.php\')); ?>
<!-- This is the posts loop, grabs the permalink, the title attributes and the title -->
<?php if (have_posts()) { ?>
<?php while (have_posts()) { ?>
<?php the_post(); ?>
<h2>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title() ?></a>
</h2>
<div>
Posted on
<a href="<?php echo get_permalink(); ?>">
<!-- Grab the date: https://www.php.net/manual/en/function.date.php -->
<time datetime="<?php echo get_the_date(\'c\') ?>" itemprop="datePublished"><?php echo the_date(); ?></time>
</a>
By <a href="<?php get_author_posts_url(get_the_author_meta(\'ID\')) ?>"><?php echo get_the_author(); ?></a>
</div>
<?php } ?>
<?php } else { ?>
<p>Sorry, no posts match your criteria.</p>
<?php } ?>
<!-- Locate the footer.php file under /templates/ -->
<?php include(locate_template(\'templates/footer.php\')); ?>
结果如下: