• Resolved Jimmy Symmonds

    (@jimmy-symmonds)


    I realised that ACF allows a relationship field type. This seems to allow CPT’s to be directly related without the need for a taxonomy.

    The following Custom Content shortcode lists the specified CPT’s as I want, but doesn’t drop the final comma in the list despite using trim=”true”.

    [related field="plant_actions" current="true" trim="true"][field title-link], [/related]

    outputs –
    Anti-inflammatory, Antibacterial, Demulcent, Emollient, Vulnerary,

    Very close 🙂 Am I using this ACF correctly with your CCS?
    If I am, does this do away with the role that CPT-onomies seems to play?

    https://ww.wp.xz.cn/plugins/custom-content-shortcode/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    Hello,

    Ah yes, it would make sense to use a trim parameter there. I implemented it in the newest update.

    For a relationship field, current=”true” is not necessary – it doesn’t do anything – because it gets the field from the current post by default.

    I was thinking that plant_action sounds like a non-hierarchical taxonomy, like tags, one or more of which could be assigned to each plant. In your previous post, it looked like that’s how you had it set up, with an ACF taxonomy field to select them. And I’m guessing that you were using CPT-onomies, so each plant_action term has its own page.

    Using a relationship field, you could have plant_action as a post type instead of a taxonomy. Then, each plant can have one or more plant_action posts assigned. Hmm.. Yes, that seems to achieve the same result in a simpler way.

    Well, it all depends on your needs – at the moment, I can’t think of any advantages that using a taxonomy would have, compared to a relationship field. So, I would go with whichever is simplest to manage. 🙂

    CPT-onomies author here! The general principle between using CPT-onomies and the ACF relationship field are the same. There are a lot of plugins that will help you create relationships between posts. It’s all just a matter of choosing which plugin works best for you! I use ACF on a lot of my sites!

    Thread Starter Jimmy Symmonds

    (@jimmy-symmonds)

    🙂 thank you Eliot and Rachel.

    Plugin Author Eliot Akira

    (@miyarakira)

    Hi Rachel, thank you for the input! Some years ago I discovered CPT-onomies and read your article on why it was created. Since then, I’ve used it on a number of large sites with complex structure, and it’s been very helpful to organize content.

    Depending on the use case, there are advantages to using CPT-onomies over relationship fields. It’s more flexible and powerful where multiple post types need to be related. There’s an “automated” aspect – when a client adds a post of some type, it’s immediately available as a taxonomy for other post types. And, having post types as taxonomies can make the structure more clear and easier to present, compared to the simpler and more “invisible” way with a field connecting posts.

    So, along with ACF, it’s a reliable and recommended plugin in the toolbox, for leveraging WordPress as a content management system. 🙂

    Thank you, Eliot, for the kind words. 🙂 I love the fact that we have tons of options at our fingertips to help make our sites awesome!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘ACF Relationship as link’ is closed to new replies.