Help with Custom Post Term URL

Hi,

I have a repeater field in ACF called Practitioners within a field group called About Pages. I have created a page that shows all the Practitioners from the repeater field and want to create a link that shows the specific Practitioner in a Single Layout I’ve made.

I’m a little unsure on how best to do that. I originally thought to create a custom taxonomy say called Practitioner and assign it to the repeater but that can’t be done.

Can you point me in the right direction please?

Thanks,
Darren

Hello Darren,

Thanks for writing in! You can use {{dc:post:permalink}} dynamic content to display or use it as the link for each Practitioner post item.

Best Regards.

Hi Ruenel,

There is only one post with all the Practitioner info saved to it as repeater fields. I can show them as a group easily enough but how do I use {{dc:post:permalink}} to link to Practitioner post items on a single layout?

thanks,
Darren.

Hello Darren,

I have checked your custom post types and I only got this:

You can only display each Practitioner in a custom single layout if it is a custom post type.

Hope this makes sense.

Hi Ruenel,

The Practitioners are in a repeater within the About Pages custom post. Do I need to add a taxonomy of Practitioner to the About Pages as well?

Regards,
Darren.

Hello @DesignMunky,

Yes, the Practitioners are in a repeater field. It is not a custom post type. You cannot have a link to each of those repeaters. It is best that you create Practitioners as a custom post type and then use a Relationship field instead.

Hope this makes sense.

Hey Ruenel,

Ahhh…ok I got you. Will reorganise - thank you.

Cheers,
Darren.

You are most welcome, Darren

Hey sorry,

Would you mind just elaborating a little more on how its best to build this? I’ve created a new Field group called Practitioners and a new Customer Post called Practitioners. How would I show them in the Website Content Forms custom post where I’m showing all my other field groups?

Id like to the User to be able to create new Practitioner posts within the Website Content Forms post if possible.

Regards,
Darren.

So I think I’m on the right track but can’t get the last piece of the puzzle worked out.
When matching the Custom post type “website-content-form” with the option field “site_to_make_live” i’m matching the title of website-content-form. So the query is:

post_type=website-content-form&p={{dc:acf:option_field field=“site_to_make_live”}}

And that works fine…

But when I get stuck when trying to match the custom post “practitioner” with “site_to_make_live”
I tried creating thew same Post Object field in “practitioner” and tried to match that with the query:

post_type=practitioner&{{dc:acf:post_field field="associated_practice_practitioners”}}={{dc:acf:option_field field=“site_to_make_live”}}

But its not working… can you show me where I’m going wrong please?

thanks
Darren.

Hello Darren,

You now have a custom post type Website Content Forms and the Practitioners. What is their relationship or what links them together? Be advised that data must be set up properly so that we can query it with ease without making it complicated. Kindly plot the two custom post types and their relationship in a diagram. When displaying one of the custom post types, you can use the diagram to formulate a query. At this moment, I do not have a clear picture as to what is needed to be displayed so I do not fully understand the data set.

Thanks for understanding.

Hi Reunel,

I hope this makes sense…

Sorry but I’m not used to making these diagrams so am not sure if i’m using the correct method.

Thanks,
Darren.

To explain what I am trying to achieve;

My goal here is to be able to show client data on different designs. And once happy with the design, create a copy of the Posts and Layouts and install on another installation.

I want to keep the flexibility of being able to swap over to different designs, show the client, then export it in one go.

I understand that doing it this way means I can only show one client at a time but that’s ok for now…unless you have a better suggestion.

Hello @DesignMunky,

Now that you have separated the Practitioners and made it as a custom post type, you can create a custom single layout for the Practitioners and another custom single layout intended for the Website Content Forms. We can then use a looper to display the Repeater field in each of the layouts since the relationship between these custom post types is established. We may be able to add links as well.

Best Regards.

Hey Ruenel,

For example…

I have a page called Mainstream 1 About Landing where I’m trying to pull in all the Practitioners that match the website-template taxonomy “Mainstream 1” and who have their Post Object field associated_practice_practitioners set to “Family Chiropractic”.

To do this I have set up a query string on the Cell for the Practitioner as follows:
post_type=practitioner&{{dc:acf:post_field field="associated_practice_practitioners”}}={{dc:acf:option_field field=“site_to_make_live”}}

with a condition: Post(has term) has Mainstream1

It pulls all the Mainstream 1 Practitioners, but isn’t giving me only the Family Chiropractic practitioners. So the query string isn’t filtering out the Practitioners by Practice.

Darren.

Hello Darren,

Can you please change the return value of your option settings?

And then try to use this argument:

$meta_query[] = array(
  'relation' => 'AND',
  array(
    'key'     => 'associated_practice_practitioners',
    'value'   => '1734',
    'compare' => '='
  ),
  array(
    'key'     => 'website_style_practitioners',
    'value'   => '33',
    'compare' => '='
  )
);

$query = array(
  'post_type'  => 'practitioner',
  'meta_query' => $meta_query
);

You may get something like:
post_type=practitioner&meta_query%5B0%5D%5Brelation%5D=AND&meta_query%5B0%5D%5B0%5D%5Bkey%5D=associated_practice_practitioners&meta_query%5B0%5D%5B0%5D%5Bvalue%5D=1734&meta_query%5B0%5D%5B0%5D%5Bcompare%5D=%3D&meta_query%5B0%5D%5B1%5D%5Bkey%5D=website_style_practitioners&meta_query%5B0%5D%5B1%5D%5Bvalue%5D=33&meta_query%5B0%5D%5B1%5D%5Bcompare%5D=%3D

where you can replace 1734 with {{dc:acf:post_field field="associated_practice_practitioners"}} and the 33 to {{dc:acf:option_field field="site_to_make_live"}} assuming that those ACF fields will return the custom post IDs.

Hope this makes sense.

Hey Ruenel,

Thank you so much for taking the time to help me with this. I’ve decided to go a different path and not require a match with Practitioner and Practice as it wont be required in the Client site and allow me to import the layouts without needing to modify them.

I read somewhere that you guys may be releasing a simpler way to get the query string you produced for me - is that true? Is it far off?

Thanks again for all your help.
Darren.

Hey Darren,

That’s great and yes, there will be an update with the query builder. You can check the full details here:

Hope that helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.