我有一个多维数组,我试图根据特定列中的值对它们进行分组.
我正试图将它们分组level,但我事先并不会真正知道这个级别.所以,这并不是说我可以把它放在一个for循环中然后说while $i < 7,因为我不知道这7是关键字的最大值,坦率地说,即使我,我也不确定我是怎么做的没有...
Array (
[0] => Array (
[cust] => XT8900
[type] => standard
[level] => 1
)
[1] => Array (
[cust] => XT8944
[type] => standard
[level] => 1
)
[2] => Array (
[cust] => XT8922
[type] => premier
[level] => 3
)
[3] => Array (
[cust] => XT8816
[type] => permier
[level] => 3
)
[4] => Array (
[cust] => XT7434
[type] => …Run Code Online (Sandbox Code Playgroud) 我想在查询帖子循环中获取自定义帖子类型的类别名称.
这是我的代码:
query_posts(array('post_type'=>'portfolio','posts_per_page'=>4, 'orderby' => 'ID', 'order' => 'DESC' ));
while ( have_posts() ) : the_post();
<li>
<div class="foli_img"> <a href="<?php echo get_permalink();?>"> <span class="next"> </span> </a> <?php the_post_thumbnail();?> </div>
<h3 class="style"><?php the_title();?></h3>
<?php the_content();?>
<h4><a href="#">I want the category name here</a></h4>
</li>
<?php endwhile;?>
Run Code Online (Sandbox Code Playgroud)