我想显示与WordPress标准不同的帖子标签。如果我理解正确的话,我对常规标记所能做的就是在它们之间和最后显示不同的东西。
标签应如下所示:
阅读更多关于标记1、标记2和标记3的信息阅读更多关于标记1和标记2的信息
我怎么才能把那个“and”字放进去?
我想显示与WordPress标准不同的帖子标签。如果我理解正确的话,我对常规标记所能做的就是在它们之间和最后显示不同的东西。
标签应如下所示:
阅读更多关于标记1、标记2和标记3的信息阅读更多关于标记1和标记2的信息
我怎么才能把那个“and”字放进去?
the_tags() 为方便起见,非常简单,如果希望对格式进行更多控制,请使用get_the_tags() 并根据需要输出它们。
编辑-模板的快速示例:
<?php
$posttags = get_the_tags();
if ($posttags) {
echo \'Read more about \';
$tag_count = count( $posttags );
$count = 0;
foreach( $posttags as $tag ) {
$count++;
if( $tag_count == $count )
$sep = \'.\';
elseif( $tag_count - 1 == $count )
$sep = \', and \';
else
$sep = \', \';
?>
<a href="<?php echo get_tag_link( $tag->term_id ); ?>" title=""><?php echo $tag->name; ?></a><?php echo $sep; ?>
<?php
}
}
?>
你好,我有个问题pre 标签突然之间\'->\' 显示为\'-> ;\' 在我的博客上。我如何解决这个问题?我已更新到最新版本。