Home Forums General Issues Text component system with ACF possible?


Text component system with ACF possible?

  • Hi,

    is it possible to build a text component system with ACF – I have ACF Pro.

    Two custom post types are to be created. One for the articles, but in which the regular block editor is not really used. Below the editor of the articles it should be possible to integrate the components from the other CPT, whose articles only contain short paragraphs and a few images. In the frontend, the page then looks like it is made of one piece, one article.

    In the backend, the mutual relationship should be visible in the singles of both CPTs. So under the Editor of the single article, should be shown up the included components and under the editor of single components, the articles in which these are integrated. The items should be clickable on both sides, so that one comes in the backend quickly to the connected elements of of the respective other CPT.

    In addition, the components should be movable in the order, but that is probably the least of the problems, as I know ACF.

    Overall, the idea is to maintain the text modules only in one place and reuse them multiple times. Think of it as a kind of FAQ system.

    Could something like this be realized with ACF? Does anyone have any tips on how to make this happen?

    Thanks in advance! If I posted in the wrong subforum, please move it. I have not found another place for conceptual questions.

  • Would you think that the above could be implemented with the new “Bidirectional Relationships”?

    For this it would be important that the list of linked articles (text modules) could be sorted by drag and drop, so that you can control the order of the elements in the backend and also the output in the frontend. As it looks, this is not possible (yet).

    I would be very interested in your view. I have a system where exactly that is implemented with the Posts 2 Posts plugin and I would want to eventually convert that to ACF.

    Thanks in advance.

  • I would create a custom post type to hold the bits and then use a repeater with a post object field. Alternately you could use a relationship without the repeater field because the selected related posts can be ordered.

    Bidirectional relationships will not work for repeater sub fields. But they would work with a top level relationship field.

    You would not be able to edit the text from both ends, the text would only be editable by editing the custom post type that holds the bits.

    If is possible that you could make it editable on both sides using the post object field in a repeater, but would be complicated. You would have to add custom JS and detect the post object field was changed and then use AJAX to get and populate another field like a textarea. Then you would need to create an acf/save_post action that transfered the content back to the post holding the text to update the other end.

  • Thank you very much for your support, John!

    It is not necessary that the text is editable from both sides. It would only be necessary to link to the other element on both sides, so that the other post (both in CPTs) can be accessed and edited.
    The articles containing a bit from the bit side, and the bits included in an article from the article.

    I hope, this makes sense. Currently, this is implemented exactly like this with the “Posts 2 Posts” plugin.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.