好吧,这不起作用是出于上帝的原因。
<div class="blog_entry">
<span class="author">Posted by --<a href="#" class="normaltip" title="Posted By"> <?php the_author(); ?></a></span>
<span class="categories">-- Category --<?php __(\'%1$s\') ?></span>
<span class="date">-- <?php __(\'%3$s\') ?> --</span>
<span class="comments"><a href="single_blog.html" class="normaltip" title="Comments"><?php comments_number( \'no responses\', \'one response\', \'% responses\' ); ?></a></span>
<span class="tags"><?php __(\'%2$s\') ?></span>
</div>
这部分代码根本没有任何意义。您试图通过打印格式字符串而不是值来输出类别和日期(
<?php __(\'%1$s\') ?>
- 这里的价值在哪里?更准确地说,你甚至没有在那里打印任何东西-
__
函数返回其值,不打印任何内容)。
下面您可以找到正确的代码
function my_entry_meta() {
// Translators: used between list items, there is a space after the comma.
$categories_list = get_the_category_list( __( \', \', \'ritualHealing\' ) );
// Translators: used between list items, there is a space after the comma.
$tag_list = get_the_tag_list( \'\', __( \', \', \'ritualHealing\' ) );
$date = sprintf( \'<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>\',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( \'c\' ) ),
esc_html( get_the_date() )
);
/* You don\'t use $author variable anywhere in your ouput (you use the_author tag instead), so it\'s redundant and should be deleted */
$author = sprintf( \'<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>\',
esc_url( get_author_posts_url( get_the_author_meta( \'ID\' ) ) ),
esc_attr( sprintf( __( \'View all posts by %s\', \'ritualHealing\' ), get_the_author() ) ),
get_the_author()
);
// This comment is wrong - I\'m guessing you copied this part of code from a theme that was using sptrinf/printf function to ouput this HTML?
//Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author\'s name.
?>
<div class="blog_entry">
<span class="author">Posted by --<a href="#" class="normaltip" title="Posted By"> <?php the_author(); ?></a></span>
<span class="categories">-- Category --<?php echo $categories_list; ?></span>
<span class="date">-- <?php echo $date; ?> --</span>
<span class="comments"><a href="single_blog.html" class="normaltip" title="Comments"><?php comments_number( \'no responses\', \'one response\', \'% responses\' ); ?></a></span>
<span class="tags"><?php echo $tag_list; ?></span>
</div><?php
/* I\'m pretty sure you don\'t need the printf call from next line */
printf(
$utility_text,
$categories_list,
$tag_list,
$date,
$author
);
}
endif;