admin管理员组文章数量:1122832
In the default wordpress rss feed the element <pubDate>
is
<pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>
and gives a result of <pubDate>Tue, 12 May 2020 12:39:03 +0000</pubDate>
how can i change this line to give a result of <pubDate>12/05/2020 12:39:03 +0000</pubDate>
(d/m/Y) or <pubDate>12-05-2020 12:39:03 +0000</pubDate>
(d-m-Y) but to be valid with RFC-822 ?
I tried many variations <pubDate><?php echo mysql2date('r', get_the_time('Y-m-d H:i:s')); ?></pubDate>
or <pubDate><?php echo get_post_time( 'd/m/Y H:i:s O', true ); ?></pubDate>
but they dont validate.
Any ideas would be appreciated.
In the default wordpress rss feed the element <pubDate>
is
<pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>
and gives a result of <pubDate>Tue, 12 May 2020 12:39:03 +0000</pubDate>
how can i change this line to give a result of <pubDate>12/05/2020 12:39:03 +0000</pubDate>
(d/m/Y) or <pubDate>12-05-2020 12:39:03 +0000</pubDate>
(d-m-Y) but to be valid with RFC-822 ?
I tried many variations <pubDate><?php echo mysql2date('r', get_the_time('Y-m-d H:i:s')); ?></pubDate>
or <pubDate><?php echo get_post_time( 'd/m/Y H:i:s O', true ); ?></pubDate>
but they dont validate.
Any ideas would be appreciated.
Share Improve this question asked Jun 7, 2020 at 11:08 HonolulumanHonoluluman 351 silver badge13 bronze badges2 Answers
Reset to default 0You can probably do this by customizing the feed:
https://codex.wordpress.org/Customizing_Feeds
This way you can make your own template for a feed, and alter the pubDate to your needs.
Where are you validating your feed, and what is the error you are seeing?
Most likely you simply need to wrap the time in CDATA. Looking at an existing feed from wordpress you can see the example:
Try replacing your pubDate
with the CDATA version and see if it validates!
本文标签: dateChange pubDate in rss feed in another format
版权声明:本文标题:date - Change pubDate in rss feed in another format 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736289166a1928248.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论