ACF relationship field help

[ad_1]

Hey all, hoping someone with a bit more experience in database queries and ACF can help me get over this conceptual hurdle, this feels doable but I think I’m just lacking the vocabulary to adequately google. Sorry if I’m over-explaining, but:

I am designing a site for client that runs a therapy practice using Oxygen Builder and ACF. I am trying to cross-reference each provider in the practice with the services they are trained to provide. The goal is for the bottom of each provider page to have a section that dynamically pulls all of the services they are qualified to provide, and for the bottom of each service page to dynamically pull a list of providers who can provide it.

Both Services and Providers are created as post categories within WordPress, if that matters. I have added an ACF relations field in every provider post, and have successfully pulled this data onto the page via Easy Posts in Oxygen using a custom query.

What I want is to run this process the other direction without having to re-enter data. On every “Services” post, I want to also pull in all of the providers that have tagged this as a service they provide. Ideally, I don’t want to also have to add a whole new ACF field on the Services posts if I can avoid it, as that just adds more ways to create confusion.

Is this doable? It feels doable, I just can’t quite wrap my brain around HOW.

Thanks in advance!

[ad_2]
2 Comments
  1. I have traditionally done this sort of thing using https://wordpress.org/plugins/custom-post-type-ui/ It let’s you create both custom post types as well as custom taxonomies.

    So if I were starting this from scratch I would create a post type for providers. I would probably choose to have this behave more like a post than a page. Then my site would have pages, posts and providers.

    Next I would create a taxonomy for services. This would work like categories or tags. Each service would have its own archive page showing all the providers that have that service. If you also want other content above that you can add a description to each term in the services taxonomy.

    Then I would modify a template to use for all the providers posts. (A unique version of single.php used for providers.) At the bottom I would include an area that lists all of their services.

    Here is an example. https://www.heidicool.com/givecamp/monsters/ has a post type for monsters. We also have taxonomies for habitats and danger levels. This is a site used purely for training purposes so it is a bit silly. But I think you can see the idea. In this case I’ve got the taxonomies listed on the right in a side menu and at the bottom of individual monster posts.

    ————–

    Of course you said you don’t want to redo this.

    So currently you have a category for services and a category for providers, is that right? Are you using tags for individual services such as aromatherapy, massage, lion-taming, Jungian Dream analysis, whatever? Are these sub categories?

    It seems to me that you should still be able to use the service category or tag archive to show all the providers for that service. It just depends on how you’ve categorized the posts.

    If you are using regular pages for each service, rather than an archive, then you would need to run a query at the bottom of the page to pull in the providers with that service. In that case you just need a special template for the services pages.

    I guess I’m not entirely sure about what does what in your current set up.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer