我只想得到这篇文章的摘录。
目前,我正在使用get_the_excerpt()
, 但它返回以下格式的字符串:
<p>LOREM IPSUM!… <a href="http://localhost/post/3" class="read-more">Read More</a></p>
我需要得到LOREM IPSUM
(真实摘录文本)仅限,不带包装<p>
标签或<a>
链接内部。有没有办法使用WordPress和PHP函数获取这个字符串?
非常感谢。
我只想得到这篇文章的摘录。
目前,我正在使用get_the_excerpt()
, 但它返回以下格式的字符串:
<p>LOREM IPSUM!… <a href="http://localhost/post/3" class="read-more">Read More</a></p>
我需要得到LOREM IPSUM
(真实摘录文本)仅限,不带包装<p>
标签或<a>
链接内部。有没有办法使用WordPress和PHP函数获取这个字符串?
非常感谢。
你可以试试这个:
$string =\'<p>LOREM IPSUM!… <a href="http://localhost/post/3" class="read-more">Read More</a></p>\';
$string = preg_replace(\'/<a[^>]*(.*?)<\\/a>/s\', \'\', $string);
echo wp_strip_all_tags($string);
//返回LOREM IPSUM!…WP_Posts_List_Table::extra_tablenav() 适用于restrict_manage_posts, 插件可以使用它输出额外的下拉列表(或其他标记),允许根据任意条件过滤表中的帖子。同样地,WP_(Users|Comments)_List_Table 有一个resttric_manage_(users|comment) 出于类似目的采取的行动。然而,据我所知,WP_Terms_List_Table 做not. 这是正确的吗?我正在编写一个插件,它严重依赖于termmeta 在各