0

我尝试在子页面列表上显示自定义字段的内容(缩略图+内容+现在预订图像+自定义字段内容),我的自定义字段名称是“krotkie-info”,这是我的代码,它显示 suppages 列表(在 page.php 中):

<?php
       $child_pages = $wpdb->get_results("SELECT *    FROM $wpdb->posts WHERE post_parent = ".$post->ID."    AND post_type = 'page' ORDER BY menu_order", 'OBJECT');    ?>
        <?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>

         <div class="child-thumb">
         <a href="<?php echo  get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>">
         <?php echo get_the_post_thumbnail($pageChild->ID, 'single-post-thumbnail'); ?>

           <?php echo $pageChild->post_title; ?>
        </a>
        <?php the_meta('krotkie-info'); ?>
        <a href="<?php echo  get_permalink($pageChild->ID); ?>"><img src="http://wanderer.ventostudio.eu/wp-content/uploads/2013/10/booknow.jpg"></a>

         </div>
<?php endforeach; endif;
?>

这是我的在线测试版我的页面

4

1 回答 1

0

尝试这个:

<?php the_meta('krotkie-info',$pageChild->ID); ?>
于 2014-02-17T19:08:35.983 回答