admin管理员组文章数量:1122832
I have a custom post type called "team".
I created a Post Object with the ACF plugin which Filter by Post Type value of "team" and I target the WordPress Posts for the location.
The idea is to associal team member with a wordpress post.
Let's say that the admin create a new post and after that select a "team member" from the post object.
If the user visit the single member page I want to show all posts associated with the current visited member.
As far as I can see I need to use "meta_query" in the post $args and check if it's equal to the current post id but I can't make it work.
What is the right way to achieve this functionality?
I have a custom post type called "team".
I created a Post Object with the ACF plugin which Filter by Post Type value of "team" and I target the WordPress Posts for the location.
The idea is to associal team member with a wordpress post.
Let's say that the admin create a new post and after that select a "team member" from the post object.
If the user visit the single member page I want to show all posts associated with the current visited member.
As far as I can see I need to use "meta_query" in the post $args and check if it's equal to the current post id but I can't make it work.
What is the right way to achieve this functionality?
Share Improve this question edited Aug 14, 2022 at 11:58 Yordan Kostadinov asked Aug 12, 2022 at 16:08 Yordan KostadinovYordan Kostadinov 491 silver badge7 bronze badges1 Answer
Reset to default 0Have you tried ACF relationships? Try this if you are looking to build a relationship betweent Team and Team Member.
https://www.advancedcustomfields.com/resources/relationship/
Here's a perfect example - https://www.advancedcustomfields.com/resources/querying-relationship-fields/
Let me know.
本文标签: Show posts associated with ACF post object and custom post type
版权声明:本文标题:Show posts associated with ACF post object and custom post type 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736290145a1928451.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论