普通网友 2014-12-15 11:16
浏览 37

按日期排序,在php / wordpress中设置数据

I have a custom post type "books" and in it there is a custom_field called "publication date". The data in this field typically looks like this "November 2014" or "July 2013".

There's already a lot of books with these values added in and I need a way to sort the posts by this publication date, instead of manually changing the publication date to a better value.

Publication date is not to the published date of the post.

Thanks!

  • 写回答

2条回答 默认 最新

  • dsfasdfsda234234 2014-12-15 11:39
    关注

    I hope this help:

       $args = array( 
          'post_type' => 'books',
          'meta_key' = 'publication_date',
          'orderby' => 'meta_value',
          'order'=>'ASC' 
        );
    
    评论

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?