如何在WordPress中对/订单get_next_post_link进行排序?
我正在使用 get_next_post_link
用于下一个和上一篇文章,但我不了解该顺序。
我想按ACF值(一个数字)对帖子进行排序,并通过上升订单。
我的代码:
<?php
if ( get_next_post_link() ) {
next_post_link();
}
?>
我的ACF字段:“位置”及其独特的价值,因此我可以对其进行排序。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试像这样的somethink
如果您还有其他逻辑可以获取下一篇文章,则需要使用wp_query来获取它,然后您可以使用get_permalink($ id)
或者您可以覆盖默认操作,该操作在WordPress中获取帖子。
Try somethink like this
https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters
https://themeisle.com/blog/re-order-wordpress-blog-posts/
If you have any other logic to get the next post you will need to use wp_query to fetch it and then you can use get_permalink($id)
Or you can overwrite the default action which fetches posts in WordPress.