私はこのWordPressのページテンプレートを特定の投稿からの抜粋を表示させようとしています。投稿が作成されたら、私は自分が望む場所にリンクを挿入することに確信していました。私はタイトル、サムネイル、パーマリンクなどをつかむことができますが、何らかの理由で私は抜粋を得ることができません。私は試しました:WordPressで投稿を取得する
the_excerpt();
get_the_excerpt();
the_content('',FALSE);
get_the_content('', FALSE, '');
get_the_content('', TRUE);
とりわけ、私が試してみたらget_the_content('', TRUE)
はリンクの後にあるすべてのコンテンツを私に渡しますが、リンクの前に何が必要なのですか?
アイデア? ?
<?php
$query = 'cat=23&posts_per_page=1';
$queryObject = new WP_Query($query);
?>
<?php if($queryObject->have_posts()) : ?>
<div>
<?php while($queryObject->have_posts()) : $queryObject->the_post() ?>
<div>
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<br>
<?php the_post_thumbnail() ?>
<?php #the_excerpt(); ?>
<div>
<a href="<?php the_permalink(); ?>">Read More</a>
</div>
</div>
<?php endwhile ?>
</div>
<?php endif; wp_reset_query();
>
ありがとうございました。これは、指定された単語数で抜粋したものを除いて動作します。私は、ユーザがその投稿のCMSを介してコンテンツ本体に ""リンクを手動で含めることができるようにしたいと考えています。このテンプレートは、そのタグを置くところで終了する抜粋を表示します。 – user2623706