Create a Bricks post via php

Henlo!

I’m moving a batch of news from an old website to a new install.

Old posts have a simple structure (classic text content + an image or video or gallery)

What i would usually do is create an ACF template for the news post type and batch create and populate those fields via php parsing the actual news dump.

I could do the same on bricks, creating a bricks template and then using the acf to display the news content but… that would mean in the future i would lose some flexibility since my post template would be bound to that kind of structure i.e. i could not alternate several text and images in the same news unless i create the news using acf repeaters/flexibles and drop the Bricks visual composer.

So… this is what i’m trying to achieve:

  • create a template or component for each of the news elements (text, image, gallery…) without using ACF
  • parse the news dump and dynamically assign to the news post all of required elements populated with the data fields i extracted.

Is there any tutorial/reference on how to populate templates via php?