WordPress单页缩略图

WordPress onepage thumbnail

我正在为 WordPress 创建单页主题。在我的 index.php 中,我列出了所有页面:

<?php $args = array(
'sort_order' => 'ASC',
'sort_column' => 'menu_order', //post_title
'hierarchical' => 1,
'exclude' => '',
'child_of' => 0,
'parent' => -1,
'exclude_tree' => '',
'number' => '',
'offset' => 0,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages($args);
//start loop
foreach ($pages as $page_data) {
$content = apply_filters('the_content', $page_data->post_content);
$title = $page_data->post_title;
$slug = $page_data->post_name;
?>
<div id='<?php echo "$slug" ?>' class="section">

<div id="inner-content" class="wrap cf">
    <div id="main" class="m-all cf" role="main">
        <div class="content">
            <h2 class="section-title"><?php echo "$title" ?></h2>
                <?php echo "$content" ?>
                <?php the_post_thumbnail('full'); ?> 
        </div>             
    </div>
</div>

<?php } ?>

但是,我的缩略图没有显示...没有错误消息,但也没有缩略图。有什么想法吗?

试试这个代码

<?php $args = array(
'sort_order' => 'ASC',
'sort_column' => 'menu_order', //post_title
'hierarchical' => 1,
'exclude' => '',
'child_of' => 0,
'parent' => -1,
'exclude_tree' => '',
'number' => '',
'offset' => 0,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages($args);
//start loop
foreach ($pages as $page_data) {
$content = apply_filters('the_content', $page_data->post_content);
$title = $page_data->post_title;
$slug = $page_data->post_name;
?>
<div id='<?php echo "$slug" ?>' class="section">

<div id="inner-content" class="wrap cf">
    <div id="main" class="m-all cf" role="main">
        <div class="content">
            <h2 class="section-title"><?php echo "$title" ?></h2>
                <?php echo "$content" ?>
         <?php echo get_the_post_thumbnail( $page_data->ID, 'thumbnail' ); ?> 
        </div>             
    </div>
</div>
<?php } ?>