サブページからコンテンツを読み込むページを作成しました。
サブページにはpost_thubnails
が含まれています。すべてのページのコンテンツを取得するためにforeach
-ループを使います。
画像を読み込めません。
<?php $args = array(
'sort_order' => 'asc',
'sort_column' => 'menu_order',
'child_of' => $post->ID,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages($args);
foreach ($pages as $page){
$file = get_post_meta ( $page->ID, '_wp_attached_file', true );
echo $file;
echo '
<div class="full_width_parallax">
<div class="wrap_1280">';
echo $page->post_content;
echo '</div>
</div>';
}
?>
サンプルコードとは別に、私はthe_post_thumbnail();
を試してみましたが、うまくいきませんでした。
何か案は?
人生は単純なことができます:
the_post_thumbnail
の代わりに私はget_the_post_thumbnail
を使うべきです
echo get_the_post_thumbnail($page->ID)