这是我的自定义代码,它将列出来自特定父级的所有页面,但现在,如何仅显示每行 4 个结果,最后一行将具有“last”类。
<?php
//this is custom query for show page from specific parent page in different page
$child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = '11' AND post_type = 'page' ORDER BY menu_order", 'OBJECT');
if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
<div class="child-thumb_home looping">
<div class="property_thumb"><a href="<?php echo get_permalink($pageChild->ID); ?>"><?php echo get_the_post_thumbnail($pageChild->ID, array(222,123)); ?></a></div>
<a href="<?php echo get_permalink($pageChild->ID); ?>" rel="bookmark" class="property_name" title="<?php echo $pageChild->post_title; ?>">
<?php echo $pageChild->post_title; ?>
</a>
<div class="some_desc"><?php the_advanced_excerpt('length=50&use_words=0&no_custom=1&ellipsis=%26hellip;&exclude_tags=img,p,strong'); ?></div>
<div class="read_more"><a href="<?php echo get_permalink($pageChild->ID); ?>">MORE INFO...</a></div>
</div>
<?php endforeach; endif; ?>
谢谢。