我正在寻找一种以随机顺序显示四个模板部分的方法。它们排列在 2x2 网格中,每次加载页面时我都需要不同的顺序。这是代码:
<!-- Feature 1 -->
<div class="grid_half">
<?php get_template_part( 'features/feat','1' ); //Get Features Section 1 ?>
</div><!-- /.grid_half -->
<!-- Feature 2 -->
<div class="grid_half_last">
<?php get_template_part( 'features/feat','2' ); //Get Features Section 2 ?>
</div><!-- /.grid_half_last -->
<div class="clear"></div>
<!-- Feature 3 -->
<div class="grid_half">
<?php get_template_part( 'features/feat','3' ); //Get Features Section 3 ?>
</div><!-- /.grid_half -->
<!-- Feature 4 -->
<div class="grid_half_last">
<?php get_template_part( 'features/feat','4' ); //Get Features Section 4 ?>
</div><!-- /.grid_half_last -->
<div class="clear"></div>