0
抜粋のないポストの最初の数単語を得るにはどうすればよいですか?私はポストワルドリーフの言葉を少ししか入手しない
$args = array(
'posts_per_page' => 5,
'offset' => 0,
'category' => '',
'category_name' => 'Energy',
'orderby' => 'date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'post',
'post_mime_type' => '',
'post_parent' => '',
'author' => '',
'author_name' => '',
'post_status' => 'publish',
'suppress_filters' => true
);
$posts_array = get_posts($args);
foreach($posts_array as $postCategory)
{
echo get_the_title($postCategory->ID);
echo get_permalink($postCategory->ID);
echo get_the_excerpt($postCategory->ID); // THIS WITH OU WITHOUT EXCERPT DOES NOT WORK
}
コードは、タイトルとパーマリンクを印刷しているが、それはポストの最初のいくつかの単語を印刷しません。
投稿の最初の数行を、引用符区切り文字があるかどうかにかかわらず印刷する方法を理解したいと思います。
おかげ
キャラクターを表示したいと思ったことに基づいて15を変更してください –