我尝试在子页面列表上显示自定义字段的内容(缩略图+内容+现在预订图像+自定义filds内容),我的自定义字段名称是“krotkie-info”,这是我的代码,显示列表of 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;
?>
以下是我的测试版在线版My page
答案 0 :(得分:0)
试试这个:
<?php the_meta('krotkie-info',$pageChild->ID); ?>