Revision: 30378
Updated Code
at August 13, 2010 01:34 by simonbouchard
Updated Code
<ul class="list"> <?php $pageChildren = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?> <?php if ( $pageChildren ) : foreach ( $pageChildren as $pageChild ) : setup_postdata( $pageChild ); ?> <li> <div class="left"> <?php echo the_post_thumbnail($pageChild->ID); ?> <div class="hover"> <a href="<?php echo get_permalink($pageChild->ID); ?>">Details</a> <a href="#">Request a Quote</a> <span class="small">MSRP: <?php echo get_post_meta($pageChild->ID,'msrp', true); ?></span> </div> </div> <div class="right"> <h5><?php echo $pageChild->post_title; ?></h5> <p><?php echo get_post_meta($pageChild->ID,'small-desc', true); ?></p> <div class="links"> <?php $grandChildren = wp_list_pages('title_li=&child_of='.$pageChild->ID.'&echo=0'); if ($grandChildren) { ?> <ul class="links"> <?php echo $grandChildren; ?> </ul> <?php } ?> </div> </div> <div class="clearfix"></div> </li> <? endforeach; endif; ?> </ul>
Revision: 30377
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 13, 2010 01:33 by simonbouchard
Initial Code
<?php $pageChildren = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?> <?php if ( $pageChildren ) : foreach ( $pageChildren as $pageChild ) : setup_postdata( $pageChild ); ?> <li> <div class="left"> <?php echo the_post_thumbnail($pageChild->ID); ?> <div class="hover"> <a href="<?php echo get_permalink($pageChild->ID); ?>">Details</a> <a href="#">Request a Quote</a> <span class="small">MSRP: <?php echo get_post_meta($pageChild->ID,'msrp', true); ?></span> </div> </div> <div class="right"> <h5><?php echo $pageChild->post_title; ?></h5> <p><?php echo get_post_meta($pageChild->ID,'small-desc', true); ?></p> <div class="links"> <?php $grandChildren = wp_list_pages('title_li=&child_of='.$pageChild->ID.'&echo=0'); if ($grandChildren) { ?> <ul class="links"> <?php echo $grandChildren; ?> </ul> <?php } ?> </div> </div> <div class="clearfix"></div> </li> <? endforeach; endif; ?>
Initial URL
Initial Description
This custom loop will list all sub pages from a parent page including grand childrens. Example use: Car models listing
Initial Title
WordPress: Custom Page Listing
Initial Tags
wordpress
Initial Language
PHP