Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想分 3 部分显示 wordpress 帖子:
标题
帖子正文的前 50 个字。
删除前 50 个单词的主要帖子文本(因为它们已经显示)
我不确定如何只显示前 50 个单词,然后从我想在下面显示的主要帖子文本中排除前 50 个单词。
有任何想法吗?
谢谢。
如果您要查找前 50 个单词而不是前 50 个字符:
$title = $post->post_title; $words = explode(' ', $post->post_content); if(count($words) > 50) { $first_fifty = array_slice($words, 0, 50); $remaining = array_slice($words, 50); }