Php 按字母顺序排列查询帖子/数组中的帖子
有人能告诉我这个怎么按字母顺序排列吗? 我试过很多东西,但似乎都不管用Php 按字母顺序排列查询帖子/数组中的帖子,php,wordpress,if-statement,echo,posts,Php,Wordpress,If Statement,Echo,Posts,有人能告诉我这个怎么按字母顺序排列吗? 我试过很多东西,但似乎都不管用 <?php query_posts( array('post__not_in' => array(46,2401), 'cat' => $category_id,'posts_per_page'=>'-1')); ?> <?php while ( have_posts() ) : the_post(); echo '<li'; if (($ID
<?php query_posts( array('post__not_in' => array(46,2401), 'cat' => $category_id,'posts_per_page'=>'-1')); ?>
<?php while ( have_posts() ) : the_post();
echo '<li';
if (($ID = get_the_ID()) == $pagepostid) echo ' class="proadv-current-item"';
//else echo ' class="post-id'.$ID.'-id'.$pagepostid.'"';
echo '>';
echo '<div class="sponsor-thumb">';
echo '<a href="'.get_permalink().'">';
the_post_thumbnail( 'category-thumb' );
echo '</a>';
echo '</div>';
echo '<a href="'.get_permalink().'">';
the_title();
echo '</a>';
echo '</li>';
endwhile; ?>
<?php wp_reset_query(); ?>
尝试在args数组中指定
orderby
:
query_posts( array('post__not_in' => array(46,2401), 'cat' => $category_id,'posts_per_page'=>'-1','orderby'=>'name','order'=>'ASC'));
你在指定排序吗?按名称按字母顺序排序?我想按名称对帖子进行排序。恐怕没有什么不同:(你还有其他想法吗?