我如何展示the_terms
带逗号和“&;”在最后一个之前
示例:
标记:书籍、评论和;历史
我需要在术语和a之间显示“,”&上学期之前。
我使用以下代码来显示the_terms
在单个岗位上:
<?php the_terms( $post->ID, \'post_tag\', \'Tags: \', \', \', \' \' ); ?>
我如何展示the_terms
带逗号和“&;”在最后一个之前
示例:
标记:书籍、评论和;历史
我需要在术语和a之间显示“,”&上学期之前。
我使用以下代码来显示the_terms
在单个岗位上:
<?php the_terms( $post->ID, \'post_tag\', \'Tags: \', \', \', \' \' ); ?>
$terms = get_the_term_list( $post->ID, \'post_tag\', \'Tags: \', \', \', \'\');
echo preg_replace(\'/^(.+),([^,]+)$/\', \'$1 &$2\', $terms);
/^(+),([^,]+)$/(美元)的说明:/ - delimiter
^ - string beginning
.+ - 1 or more characters
[^,]+ - 1 or more characters that are not a comma
$ - string end
$n是第n个匹配项,即第n对括号我的类别基本上是作者,我想创建一个函数,根据他们的姓氏列出他们。例如,我想要一些类似于:E:海因茨·埃哈德(Heinz Erhardt)阿尔伯特·爱因斯坦(Albert Einstein)艾米纳姆(Eminem)的问题是,我也有一些作者只有一个名字(如“Eminem”),我也希望按照字母E进行排序。我知道在wordpress中这样做的唯一方法是使用get_terms 功能和name__like.function getAuthors(){ $args = array( \'name