由于 Genisis 框架中的某些原因,wordpress 以下代码没有拉出子页面及其特色图像
add_filter( 'body_class', 'add_body_class' );
function add_body_class( $classes ) {
$classes[] = 'portfolio';
return $classes;
}
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); // Force Full-Width Layout
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); // Removes breadcrumbs
remove_action( 'genesis_post_title','genesis_do_post_title' ); // Removes post title
remove_action( 'genesis_post_content', 'genesis_do_post_content' ); // Removes content
add_action( 'genesis_post_content', 'child_do_content' ); // Adds your custom page code/content
// Do Custom Content
function child_do_content() { ?>
<?php global $wpdb; ?>
<?php the_content(); ?>
<?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 ); ?>
<?php echo get_the_post_thumbnail($pageChild->ID, 'thumbnail'); ?>
<a href="<?php echo get_permalink($pageChild->ID); ?>" title="<?php echo $pageChild->post_title; ?>"><?php echo $pageChild->post_title; ?></a>
<?php endforeach; endif; ?>
<?php }genesis();
谢谢你。