admin管理员组文章数量:1122846
My theme's archive template uses this for the loop,
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Seems to be ordered by post title but I need them ordered by the post id. Just need help with the syntax i think. How do I change the order of the loop list of posts or incorporate this in to the loop? I am researching this but if anyone has a simple solution I would be extremely grateful.
$args = array(
'orderby' => 'ID',
'order' => 'ASC',
);
$query = new WP_query ( $args );
My theme's archive template uses this for the loop,
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Seems to be ordered by post title but I need them ordered by the post id. Just need help with the syntax i think. How do I change the order of the loop list of posts or incorporate this in to the loop? I am researching this but if anyone has a simple solution I would be extremely grateful.
$args = array(
'orderby' => 'ID',
'order' => 'ASC',
);
$query = new WP_query ( $args );
Share
Improve this question
asked Jun 21, 2017 at 0:13
Joe BarrettJoe Barrett
236 bronze badges
3
- taxonomy-places.php is the template, the term is obviously, places – Joe Barrett Commented Jun 21, 2017 at 0:18
- Found answer here, easy enough, but how do I only apply this function to archive-places? wordpress.stackexchange.com/questions/39817/… – Joe Barrett Commented Jun 21, 2017 at 0:35
- I used this, if(is_archive( 'taxonomy-places.php')): – Joe Barrett Commented Jun 21, 2017 at 0:40
1 Answer
Reset to default 0I used this Sort results by name & asc order on Archive.php
changed to select the archive template if(is_archive( 'taxonomy-places.php')):
本文标签: loopOrder archive results by post id in custom taxonomy template
版权声明:本文标题:loop - Order archive results by post id in custom taxonomy template 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736282398a1926632.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论