wordpress 特定の記事IDを指定してアイキャッチを表示
<?php
$query_feature = new WP_Query(
array('post_type' => 'postとかpageとかカスタム投稿の名前featureとか')
);
?>
<?php if ($query_feature->have_posts()):
$query_feature->the_post(); ?>
<?php $feature_post_id = 1523; ?>// ←指定記事のID
<a class="funcItem" href="<?php echo get_permalink($feature_post_id); ?>">
<div class="funcItem__img"><?php echo get_the_post_thumbnail($feature_post_id, 'full'); ?></div>
<h3 class="funcItem__title"><?php echo get_post($feature_post_id )->post_title; ?></h3>
</a>
<?php endif; wp_reset_postdata(); ?>
備忘録。
0 notes
https://whitewood-hp.com/web-tips/archives/2603
位置変更できたけど、今までコンテンツ下に出てたフィールドが消えた。。とりあえずブックマーク
でも、もう一度function.phpから追記したコードを消して、投稿画面右上の「表示オプション」からフィールドグループ名をチェック入れたら表示されました!焦った。良かった。
0 notes