• Resolved taidgh

    (@taidgh)


    Hi, Really appreciate your plugin. I seem to be having an issue with nested elements. I have tried multiple syntax and RTFM before asking.
    My json is:

    [
       {
          "ID":87600,
          "the_name":"John Smith",
          "custom_fields":{
             "collab_phone":[
                "+1-352-608-6346"
             ],
             "collab_email":[
                "info@john.com"
             ]
          },
          "post_date":"2020-10-07 01:56:36"
       },
       {
          "ID":87405,
          "the_name":"Jane Doe",
          "custom_fields":{
             "collab_phone":[
                "+1-352-608-6346"
             ],
             "collab_email":[
                "info@jane.com"
             ]
          },
          "post_date":"2020-10-02 04:51:07"
       },
          {
          "ID":87405,
          "the_name":"Michael Moe",
          "custom_fields":{
             "collab_phone":[
                ""
             ],
             "collab_email":[
                "info@michael.com"
             ]
          },
          "post_date":"2020-10-02 04:51:07"
       },
    ]

    My code is:

    <table>
      <thead>
    <tr>
       <th>Name</th>
       <th>Email</th>
       <th>Phone</th>
       <th>Date</th>
       <th>ID</th>
    </tr>
    </thead>
    <tbody>
    [jsoncontentimporter url="https://petscams.com/wp-json/rest-routes/v2/85130" basenode=custom_fields numberofdisplayeditems=3 ]
     <tr>
         <td>{the_name}</td>
         <td>{custom_fields.collab_phone:}</td>
         <td>{custom_fields.collab_email}</td>
         <td>{post_date}</td>
         <td>{ID}</td>
     </tr>
    [/jsoncontentimporter]
    </tbody>
    </table>

    I have of course tried multiple combinations for {custom_fields.collab_phone:} and {custom_fields.collab_email:} but everything except for phone and email appear.
    Would very much appreciate some help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author berkux

    (@berkux)

    Hi,

    try

    <table>
      <thead>
    <tr>
       <th>Name</th>
       <th>Email</th>
       <th>Phone</th>
       <th>Date</th>
       <th>ID</th>
    </tr>
    </thead>
    <tbody>
    [jsoncontentimporter url="https://petscams.com/wp-json/rest-routes/v2/85130" numberofdisplayeditems=30]
     <tr>
         <td>{post_title}
    </td>
         <td>
    {subloop:custom_fields:-1}
    {subloop-array:custom_fields.collab_phone:10}{0}
    {/subloop-array:custom_fields.collab_phone}
    </td><td>
    {subloop-array:custom_fields.collab_email:10}{0}
    {/subloop-array:custom_fields.collab_email}
    
    {/subloop:custom_fields}
    {custom_fields.collab_phone:}
    
    {custom_fields.collab_email}</td>
         <td>{post_date}</td>
         <td>{ID}</td>
     </tr>
    [/jsoncontentimporter]
    </tbody>
    </table>

    Bernhard

    Thread Starter taidgh

    (@taidgh)

    Very much appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Fields not showing’ is closed to new replies.