我已经输出了我的档案描述,如下所示。然而,我想在一个地方显示标签之前的第一部分和其他地方的其他地方不包括第一部分。有没有办法将其拆分,以输出两个不同的数据?只需使用第一段即可拆分。
the_archive_description( '<div class="taxonomy-description">', '</div>' );发布于 2018-04-14 00:52:32
请尝试使用get_the_archive_description() 。这将返回描述而不是显示它,这将允许您在显示(或不显示)它的部分之前使用自己的代码随心所欲地操作它。有点像这样:
$myDescription = get_the_archive_description();
$sections = explode('<!-- more -->', $myDescription);
echo __( $sections[0], 'default' ); //Put this wherever you want to display the first part
echo __( $sections[1], 'default' ); //Put this wherever you want to display the resthttps://stackoverflow.com/questions/49819045
复制相似问题