• colind

    (@colind)


    Let’s say I wanted to make a widget with a set of images. I’ve worked out how to store an array in my widget options:
    <input class="image-id-value" type="hidden" name="<?php echo $this->get_field_name( 'attachment_ids' ) ?>[<?php echo $key ?>]" value="<?php echo $image_id; ?>">

    And to store that via my update options.

    But what if I wanted each image to be an array:

    $image['id']
    $image['caption']
    $image['link']

    Or an object:

    $image->id
    $image->caption
    $image->link

    Is there a straightforward way to set up the data that I place in the input value so that i can store it nicely in ‘update_options’?

    Can anyone suggest some example plugins that accomplish this that I could look at?

  • The topic ‘Complex widget options’ is closed to new replies.