Come mostrare titolo e riassunto delle Child Pages di una pagina Genitore in WordPress
Con questo codice puoi mostrare in una pagina personalizzata di wordpress tutte le pagine “figlie” di una pagina principale.
[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 ); ?>
<h2 class="subpagetitle"><a href="<?php echo get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"><?php echo $pageChild->post_title; ?></a></h2>
<?php/* And if you want to get the custom field values then you can get that by */
$your_custom_field = get_post_meta($pageChild->ID, ‘your_custom_field’, $single = true);
the_excerpt();?>
<?php endforeach; endif; ?>[/php]