WordPress.org

Ready to get started?Download WordPress

Forums

Quick question. Help me save my theme options. (2 posts)

  1. prionkor
    Member
    Posted 3 years ago #

    Hi, let i have a theme option named 'option' now i want to assign a array in it from some text input generated my jquery. now how do i update the theme option to save the content of the fields to the 'option' like this:

    'option' = array('option 1', 'option 2', etc...);

    simple to understand but if you want more code example i can give details.

  2. prionkor
    Member
    Posted 3 years ago #

    Hi, i figured out how to do it :)
    here:
    <input type="text" size="25" name="<?php echo '[home_slides][]'; ?>" value="<?php echo $slide; ?>" />
    here 'home_slides' is the theme option which is an array. the text area will be added if we add the text input name like this [home_slides][]. But this way the content of the array will be like this:

    array(
           0=>'value 0',
           1=>'value 1',
           2=>'value 2'
          );

    But i was wondering if anyone know if there is a way to insert the data into keys to. So, the new plan is to insert text to keys and value from two text field.

    array(
           text_field_1=>'text_field_2',
           text_field_1=>'text_field_2'
          );

    let me know if you have any idea. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic