最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

query - Order RSS content by an advanced custom field value

programmeradmin0浏览0评论

I have created a custom post-type called "event".

For this custom post-type I created an advanced custom field called "event_date".

Now I am trying to display the list of my events in a RSS feed.

I figured out how to display custom fields and featured image in my RSS feed but I cant figure out how to re-arrange the feed content according to the event_date and not the date when the post was created...

Can someone help me with a URL string query for RSS feed or a simple line I can add to my functions.php?

Thanks a lot in advance!

I have created a custom post-type called "event".

For this custom post-type I created an advanced custom field called "event_date".

Now I am trying to display the list of my events in a RSS feed.

I figured out how to display custom fields and featured image in my RSS feed but I cant figure out how to re-arrange the feed content according to the event_date and not the date when the post was created...

Can someone help me with a URL string query for RSS feed or a simple line I can add to my functions.php?

Thanks a lot in advance!

Share Improve this question asked Dec 3, 2019 at 5:22 Natalia DavydovaNatalia Davydova 111 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

hope this code will helpful for you

    $args = array(
  'post_type'         =>'event',
  'post_status'       => 'publish',
  'posts_per_page'    => -1,
  'meta_key'          => 'event_date',
  'orderby'           => 'meta_value_num',
  'order'             => 'DESC'
);
发布评论

评论列表(0)

  1. 暂无评论