• Resolved jdelatorre312

    (@jdelatorre312)


    Hi,
    I’m trying to use php to programmatically add two loops to a page. The loop consists of a file upload and a text input. I found the below in the documentation.

    $field_data = array(
        'text_field' => 'Value',
        'loop_field' => array(
            array(
                'loop_text' => 'Value',
                'loop_date' => '2013-01-01 10:30:00',
            ),
            array(
                'loop_text' => 'Value',
                'loop_date' => '2013-01-02 12:45:00',
            ),
        ),
    );
    $post_data = array('ID' => 678); // the ID is required
    CFS()->save($field_data, $post_data);

    My question is, how do I add multiple loops for a post? I tried to add one and was able to do it, but I can’t seem to do two loops. Any help would be appreciated.

    https://ww.wp.xz.cn/plugins/custom-field-suite/

Viewing 1 replies (of 1 total)
  • Plugin Author Matt Gibbs

    (@mgibbs189)

    Do you have 2 separate top-level loop fields, or are you referring to a loop field within a loop field?

Viewing 1 replies (of 1 total)

The topic ‘Use the Add/Update API’ is closed to new replies.