首先,我会说是的,我搜索过了,然后是的,我找到了an answer to this question. 这基本上是我提出的解决方案,但我想确保这不是一个糟糕的解决方案。
这是真正的问题。我想把帖子标题作为某些类型帖子第一段的一部分。我的解决方案很简单。我把这个叫做the_content
对于特定类别。
function yb_link_post() {
$link_post_title = \'<b class="headline"><a href="\' . get_permalink() . \'" title="\' . get_the_title() . \'">\' . get_the_title() . \'</a></b>\';
$link_post_content = $link_post_title . \' — \' . get_the_content();
remove_filter(\'the_content\', \'wpautop\');
echo wpautop($link_post_content);
add_filter(\'the_content\', \'wpautop\');
}
那么这是一种不好的方式吗?我有种预感,先删除然后添加wpautop
可能会产生我没有考虑的影响。谁能告诉我这是一个好的解决方案,还是有更聪明的方法?