douwo1862
douwo1862
2017-06-20 12:58
浏览 6
已采纳

添加orderby进行查询

Short question. How to add order by date to this query?

<?php
           if ( have_posts() ) while ( have_posts() ) : the_post();
            the_content();
           endwhile;

           if($post->post_parent)
           $children = wp_list_pages("title_li=&child_of=".$post->ID."&depth=1&echo=0");
           if ($children) { ?>

图片转代码服务由CSDN问答提供 功能建议

简短问题。 如何按日期向此查询添加订单?

 &lt;?php 
 if(have_posts())while(have_posts()):the_post(); 
 the_content(); 
 endwhile; 
 
 if($ post-&gt; post_parent)  
 $ children = wp_list_pages(“title_li =&amp; child_of =”。$ post-&gt; ID。“&amp; depth = 1&amp; echo = 0”); 
 if($ children){?&gt; 
 <  / code>  
 
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dousi1906
    dousi1906 2017-06-20 13:04
    已采纳

    You can sort the pages by using "sort_column" parameter, The parameter has different values. It accepts following values.

    'post_author', 'post_date', 'post_title', 'post_name', 'post_modified', 'post_modified_gmt', 'menu_order', 'post_parent', 'ID', 'rand', or 'comment_count'.

    wp_list_pages("title_li=&child_of=".$post->ID."&depth=1&echo=0&sort_column=post_date");
    
    点赞 评论

相关推荐