Skip to content

Add data from advanced custom fields #7

@h3llr4iser

Description

@h3llr4iser

Hello,

I need to add data from plugin ACF (https://www.advancedcustomfields.com/) to the Page Model. Wordpress have a plugin to expose data from ACF (https://github.com/airesvsg/acf-to-rest-api):

{
    "id": 1,
    "date": "2019-11-07T13:10:27",
    "date_gmt": "2019-11-07T12:10:27",
    "guid": {
      "rendered": "http:\/\/localhost:8000\/?p=1"
    },
    "modified": "2019-11-07T14:16:37",
    "modified_gmt": "2019-11-07T13:16:37",
    "slug": "hola-mundo",
    "status": "publish",
    "type": "post",
    "link": "http:\/\/localhost:8000\/hola-mundo\/",
    "title": {
      "rendered": "\u00a1Hola, mundo!"
    },
    "content": {
      "rendered": "\n<p>test<\/p>\n",
      "protected": false
    },
    "excerpt": {
      "rendered": "<p>test<\/p>\n",
      "protected": false
    },
    "author": 1,
    "featured_media": 0,
    "comment_status": "open",
    "ping_status": "open",
    "sticky": false,
    "template": "",
    "format": "standard",
    "meta": [],
    "categories": [
      1
    ],
    "tags": [],
    "acf": {
      "custom_field_1": "test 1",
      "custom_field_2": "test 2"
    }
}

 "acf": {
      "custom_field_1": "test 1",
      "custom_field_2": "test 2"
    }

I am thinking what would be the best option to add this to your bundle. The easy way is to modify the Page Model adding a new property $acf.

Ca I do a pull request with this modification?

Another possibility is to add to the bundle configuration and option to override models.

thx.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions